From dc11e61373acd99339c8353657c151ea32795e76 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 20 Jun 2024 22:14:30 +0000 Subject: [PATCH 1/2] feat: add use_topic_schema for Cloud Storage Subscriptions PiperOrigin-RevId: 643385701 Source-Link: https://github.com/googleapis/googleapis/commit/f29a82a206156fd665eaa01cb7987170ac0250f0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/f8f3f60ad2ab4e81fe024368ad0430900174e82b Copy-Tag: eyJwIjoiUHViU3ViLy5Pd2xCb3QueWFtbCIsImgiOiJmOGYzZjYwYWQyYWI0ZTgxZmUwMjQzNjhhZDA0MzA5MDAxNzRlODJiIn0= --- .../GPBMetadata/Google/Pubsub/V1/Pubsub.php | Bin 0 -> 15721 bytes .../GPBMetadata/Google/Pubsub/V1/Schema.php | Bin 0 -> 5034 bytes .../Cloud/PubSub/V1/AcknowledgeRequest.php | 132 ++ .../Google/Cloud/PubSub/V1/BigQueryConfig.php | 347 ++++ .../Cloud/PubSub/V1/BigQueryConfig/State.php | 91 + .../Cloud/PubSub/V1/CloudStorageConfig.php | 468 +++++ .../V1/CloudStorageConfig/AvroConfig.php | 129 ++ .../PubSub/V1/CloudStorageConfig/State.php | 88 + .../V1/CloudStorageConfig/TextConfig.php | 38 + .../Cloud/PubSub/V1/CommitSchemaRequest.php | 132 ++ .../Cloud/PubSub/V1/CreateSchemaRequest.php | 200 ++ .../Cloud/PubSub/V1/CreateSnapshotRequest.php | 221 +++ .../Cloud/PubSub/V1/DeadLetterPolicy.php | 164 ++ .../Cloud/PubSub/V1/DeleteSchemaRequest.php | 86 + .../PubSub/V1/DeleteSchemaRevisionRequest.php | 143 ++ .../Cloud/PubSub/V1/DeleteSnapshotRequest.php | 86 + .../PubSub/V1/DeleteSubscriptionRequest.php | 86 + .../Cloud/PubSub/V1/DeleteTopicRequest.php | 86 + .../PubSub/V1/DetachSubscriptionRequest.php | 71 + .../PubSub/V1/DetachSubscriptionResponse.php | 34 + .../src/Google/Cloud/PubSub/V1/Encoding.php | 62 + .../Cloud/PubSub/V1/ExpirationPolicy.php | 98 + .../Cloud/PubSub/V1/GetSchemaRequest.php | 124 ++ .../Cloud/PubSub/V1/GetSnapshotRequest.php | 86 + .../PubSub/V1/GetSubscriptionRequest.php | 86 + .../Cloud/PubSub/V1/GetTopicRequest.php | 86 + .../PubSub/V1/IngestionDataSourceSettings.php | 75 + .../AwsKinesis.php | 234 +++ .../AwsKinesis/State.php | 95 + .../PubSub/V1/ListSchemaRevisionsRequest.php | 195 ++ .../PubSub/V1/ListSchemaRevisionsResponse.php | 105 ++ .../Cloud/PubSub/V1/ListSchemasRequest.php | 204 ++ .../Cloud/PubSub/V1/ListSchemasResponse.php | 105 ++ .../Cloud/PubSub/V1/ListSnapshotsRequest.php | 162 ++ .../Cloud/PubSub/V1/ListSnapshotsResponse.php | 109 ++ .../PubSub/V1/ListSubscriptionsRequest.php | 162 ++ .../PubSub/V1/ListSubscriptionsResponse.php | 109 ++ .../PubSub/V1/ListTopicSnapshotsRequest.php | 162 ++ .../PubSub/V1/ListTopicSnapshotsResponse.php | 109 ++ .../V1/ListTopicSubscriptionsRequest.php | 162 ++ .../V1/ListTopicSubscriptionsResponse.php | 113 ++ .../Cloud/PubSub/V1/ListTopicsRequest.php | 162 ++ .../Cloud/PubSub/V1/ListTopicsResponse.php | 105 ++ .../Cloud/PubSub/V1/MessageStoragePolicy.php | 137 ++ .../PubSub/V1/ModifyAckDeadlineRequest.php | 198 ++ .../PubSub/V1/ModifyPushConfigRequest.php | 153 ++ .../Google/Cloud/PubSub/V1/PublishRequest.php | 122 ++ .../Cloud/PubSub/V1/PublishResponse.php | 75 + .../Google/Cloud/PubSub/V1/PubsubMessage.php | 280 +++ .../Google/Cloud/PubSub/V1/PullRequest.php | 222 +++ .../Google/Cloud/PubSub/V1/PullResponse.php | 83 + .../src/Google/Cloud/PubSub/V1/PushConfig.php | 294 +++ .../Cloud/PubSub/V1/PushConfig/NoWrapper.php | 78 + .../Cloud/PubSub/V1/PushConfig/OidcToken.php | 146 ++ .../PubSub/V1/PushConfig/PubsubWrapper.php | 38 + .../Cloud/PubSub/V1/ReceivedMessage.php | 189 ++ .../Google/Cloud/PubSub/V1/RetryPolicy.php | 140 ++ .../Cloud/PubSub/V1/RollbackSchemaRequest.php | 128 ++ .../src/Google/Cloud/PubSub/V1/Schema.php | 225 +++ .../Google/Cloud/PubSub/V1/Schema/Type.php | 64 + .../Google/Cloud/PubSub/V1/SchemaSettings.php | 197 ++ .../src/Google/Cloud/PubSub/V1/SchemaView.php | 62 + .../Google/Cloud/PubSub/V1/SeekRequest.php | 178 ++ .../Google/Cloud/PubSub/V1/SeekResponse.php | 33 + .../src/Google/Cloud/PubSub/V1/Snapshot.php | 227 +++ .../Cloud/PubSub/V1/StreamingPullRequest.php | 491 +++++ .../Cloud/PubSub/V1/StreamingPullResponse.php | 208 +++ .../AcknowledgeConfirmation.php | 181 ++ .../ModifyAckDeadlineConfirmation.php | 147 ++ .../SubscriptionProperties.php | 108 ++ .../Google/Cloud/PubSub/V1/Subscription.php | 1090 +++++++++++ .../Cloud/PubSub/V1/Subscription/State.php | 66 + .../src/Google/Cloud/PubSub/V1/Topic.php | 473 +++++ .../Google/Cloud/PubSub/V1/Topic/State.php | 66 + .../Cloud/PubSub/V1/UpdateSnapshotRequest.php | 141 ++ .../PubSub/V1/UpdateSubscriptionRequest.php | 141 ++ .../Cloud/PubSub/V1/UpdateTopicRequest.php | 156 ++ .../PubSub/V1/ValidateMessageRequest.php | 217 +++ .../PubSub/V1/ValidateMessageResponse.php | 34 + .../Cloud/PubSub/V1/ValidateSchemaRequest.php | 132 ++ .../PubSub/V1/ValidateSchemaResponse.php | 34 + .../V1/PublisherClient/create_topic.php | 75 + .../V1/PublisherClient/delete_topic.php | 74 + .../PublisherClient/detach_subscription.php | 75 + .../V1/PublisherClient/get_iam_policy.php | 72 + .../samples/V1/PublisherClient/get_topic.php | 72 + .../PublisherClient/list_topic_snapshots.php | 80 + .../list_topic_subscriptions.php | 76 + .../V1/PublisherClient/list_topics.php | 77 + .../v1/samples/V1/PublisherClient/publish.php | 76 + .../V1/PublisherClient/set_iam_policy.php | 77 + .../PublisherClient/test_iam_permissions.php | 84 + .../V1/PublisherClient/update_topic.php | 81 + .../V1/SchemaServiceClient/commit_schema.php | 78 + .../V1/SchemaServiceClient/create_schema.php | 78 + .../V1/SchemaServiceClient/delete_schema.php | 70 + .../delete_schema_revision.php | 79 + .../V1/SchemaServiceClient/get_iam_policy.php | 72 + .../V1/SchemaServiceClient/get_schema.php | 72 + .../list_schema_revisions.php | 76 + .../V1/SchemaServiceClient/list_schemas.php | 77 + .../SchemaServiceClient/rollback_schema.php | 77 + .../V1/SchemaServiceClient/set_iam_policy.php | 77 + .../test_iam_permissions.php | 84 + .../SchemaServiceClient/validate_message.php | 72 + .../SchemaServiceClient/validate_schema.php | 79 + .../V1/SubscriberClient/acknowledge.php | 82 + .../V1/SubscriberClient/create_snapshot.php | 103 + .../SubscriberClient/create_subscription.php | 90 + .../V1/SubscriberClient/delete_snapshot.php | 78 + .../SubscriberClient/delete_subscription.php | 74 + .../V1/SubscriberClient/get_iam_policy.php | 72 + .../V1/SubscriberClient/get_snapshot.php | 76 + .../V1/SubscriberClient/get_subscription.php | 72 + .../V1/SubscriberClient/list_snapshots.php | 81 + .../SubscriberClient/list_subscriptions.php | 77 + .../SubscriberClient/modify_ack_deadline.php | 92 + .../SubscriberClient/modify_push_config.php | 78 + .../v1/samples/V1/SubscriberClient/pull.php | 77 + .../v1/samples/V1/SubscriberClient/seek.php | 77 + .../V1/SubscriberClient/set_iam_policy.php | 77 + .../V1/SubscriberClient/streaming_pull.php | 92 + .../SubscriberClient/test_iam_permissions.php | 84 + .../V1/SubscriberClient/update_snapshot.php | 67 + .../SubscriberClient/update_subscription.php | 90 + .../v1/src/V1/Client/PublisherClient.php | 656 +++++++ .../v1/src/V1/Client/SchemaServiceClient.php | 604 ++++++ .../v1/src/V1/Client/SubscriberClient.php | 905 +++++++++ .../v1/src/V1/Gapic/PublisherGapicClient.php | 1117 +++++++++++ .../src/V1/Gapic/SchemaServiceGapicClient.php | 1006 ++++++++++ .../v1/src/V1/Gapic/SubscriberGapicClient.php | 1664 +++++++++++++++++ .../PubSub/v1/src/V1/PublisherClient.php | 34 + .../PubSub/v1/src/V1/SchemaServiceClient.php | 34 + .../PubSub/v1/src/V1/SubscriberClient.php | 34 + .../PubSub/v1/src/V1/gapic_metadata.json | 256 +++ .../V1/resources/publisher_client_config.json | 132 ++ .../resources/publisher_descriptor_config.php | 208 +++ .../publisher_rest_client_config.php | 217 +++ .../schema_service_client_config.json | 99 + .../schema_service_descriptor_config.php | 207 ++ .../schema_service_rest_client_config.php | 229 +++ .../resources/subscriber_client_config.json | 172 ++ .../subscriber_descriptor_config.php | 280 +++ .../subscriber_rest_client_config.php | 290 +++ .../Unit/V1/Client/PublisherClientTest.php | 941 ++++++++++ .../V1/Client/SchemaServiceClientTest.php | 1037 ++++++++++ .../Unit/V1/Client/SubscriberClientTest.php | 1494 +++++++++++++++ .../v1/tests/Unit/V1/PublisherClientTest.php | 841 +++++++++ .../tests/Unit/V1/SchemaServiceClientTest.php | 919 +++++++++ .../v1/tests/Unit/V1/SubscriberClientTest.php | 1353 ++++++++++++++ 150 files changed, 30644 insertions(+) create mode 100644 owl-bot-staging/PubSub/v1/proto/src/GPBMetadata/Google/Pubsub/V1/Pubsub.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/GPBMetadata/Google/Pubsub/V1/Schema.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/AcknowledgeRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig/State.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/AvroConfig.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/State.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/TextConfig.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CommitSchemaRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSchemaRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSnapshotRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeadLetterPolicy.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRevisionRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSnapshotRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSubscriptionRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteTopicRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionResponse.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Encoding.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ExpirationPolicy.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSchemaRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSnapshotRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSubscriptionRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetTopicRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis/State.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsResponse.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasResponse.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsResponse.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsResponse.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsResponse.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsResponse.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsResponse.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/MessageStoragePolicy.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyAckDeadlineRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyPushConfigRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishResponse.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PubsubMessage.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullResponse.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/NoWrapper.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/OidcToken.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/PubsubWrapper.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ReceivedMessage.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RetryPolicy.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RollbackSchemaRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema/Type.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaSettings.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaView.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekResponse.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Snapshot.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/AcknowledgeConfirmation.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/ModifyAckDeadlineConfirmation.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/SubscriptionProperties.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription/State.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic/State.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSnapshotRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSubscriptionRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateTopicRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageResponse.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaRequest.php create mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaResponse.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/create_topic.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/delete_topic.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/detach_subscription.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_iam_policy.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_topic.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_snapshots.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_subscriptions.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topics.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/publish.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/set_iam_policy.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/test_iam_permissions.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/update_topic.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/commit_schema.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/create_schema.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema_revision.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_iam_policy.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_schema.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schema_revisions.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schemas.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/rollback_schema.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/set_iam_policy.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/test_iam_permissions.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_message.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_schema.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/acknowledge.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_snapshot.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_subscription.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_snapshot.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_subscription.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_iam_policy.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_snapshot.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_subscription.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_snapshots.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_subscriptions.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_ack_deadline.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_push_config.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/pull.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/seek.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/set_iam_policy.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/streaming_pull.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/test_iam_permissions.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_snapshot.php create mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_subscription.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/Client/PublisherClient.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/Client/SchemaServiceClient.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/Client/SubscriberClient.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/Gapic/PublisherGapicClient.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/Gapic/SchemaServiceGapicClient.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/Gapic/SubscriberGapicClient.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/PublisherClient.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/SchemaServiceClient.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/SubscriberClient.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/gapic_metadata.json create mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/publisher_client_config.json create mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/publisher_descriptor_config.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/publisher_rest_client_config.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_client_config.json create mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_descriptor_config.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_rest_client_config.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_client_config.json create mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_descriptor_config.php create mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_rest_client_config.php create mode 100644 owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/PublisherClientTest.php create mode 100644 owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SchemaServiceClientTest.php create mode 100644 owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SubscriberClientTest.php create mode 100644 owl-bot-staging/PubSub/v1/tests/Unit/V1/PublisherClientTest.php create mode 100644 owl-bot-staging/PubSub/v1/tests/Unit/V1/SchemaServiceClientTest.php create mode 100644 owl-bot-staging/PubSub/v1/tests/Unit/V1/SubscriberClientTest.php diff --git a/owl-bot-staging/PubSub/v1/proto/src/GPBMetadata/Google/Pubsub/V1/Pubsub.php b/owl-bot-staging/PubSub/v1/proto/src/GPBMetadata/Google/Pubsub/V1/Pubsub.php new file mode 100644 index 0000000000000000000000000000000000000000..493b7610f5b5d4d680f0156ba5f5e1a8d836fff7 GIT binary patch literal 15721 zcmc&*OKclSdUjKmEd7)vxkj>S`bD?BV_BBP5y#o_aMt!x5^V`%Jw}wB#Y9P`MYg1l zNOo^`Q?h2($Yznl<_QFw2arR8AV3f-kXsIm%_)}z*+UX+ZaVEDCtq?6_LRR~%_6%= zN*ZN%F4nNB{`%{G|6f&qJ!fIw^bt6+;SlYOaOMR!|m92bc$8mP5R@QB7`HijY{;c?GhEW2jn>EXK z&9aqwu{O7C1!lzz%*_{U(dHUkwE24W6M%Bn^!*I~1-^s~{)aTHb~)n*W`O_PwSB{` z+ktIX?JtnyCz)-t>RY%pI(NHKF9)_$&(H;{^|Cd2Kf`I#xp!R$PxvGgvOy1x2i{z& z2bNbitD6g!U-oP_aJ)5~n$Pc8K`1Kv%jA8rEhT4fXC^t1`Fw=QCz-%&SnBSXjAsQ6 zul@<+n-X{%{8pBQw%ZJM}Nvzgigiywf1p~YE2A=fkYTYmhWCe z-G~{IwUB%u6(A-=rQkCu^I_eD@ny^R%^jdb+M)iI(lULMLvwvUD`?~v5UalJVBEt+-JcZ_KQG*b>p~e^Ca4F027_&uuO_oFh)g&YB*Ey9bkX zMKOajcM~pc+nygFpfab4c9r|e`wHW!4+|$#N zpD9r)bdx@E1;7tH%d8ouS7*Xx+DwqEFkD6jH)@v0hC*4fA$nNPsak9(lv9Fa;Jux) zYxtJ8Z=)TU<+9VL2dRE3$%Ovr8uYXM$pl;~Z4@?&#;cXmT5*2q`BHIV>>L3YD9mpx zy)KSv*bZMnnS}GZ9#r5T-QfX;*#aJk=(5VSJy!LADH6ybZr#~yrcnGJDmCri_pJsRvQ*~jC|s;rZ1kr ze6K@lY2`(+v_Y+Qy;xd(wLV`oitFpE>tl)h#=F92a4kO2ar3*4!Th(Za^Ppb6o0+V z2GlU|2lnqsFxe68m%pmaWtwvx;L(WEJ z*FtBe5Ux;+8r@YIgbb+U0~p3rRc(LQph+l2<3myj(b6o!5`hLA$E#Q#Dw&#eGhS%v zSr~2GxTlJWF#5s@m%TcO@z{ zHl4~jf$1&TU?dEhshJhU3F0{|C1{<+R_Wh?5tKZY-&bItd>sabW~7F1MR{$}FyH+F zjE1}WE~WsBq#)T;vYPYt-`C*MORNdlnSIIb0$dRGD&+kkllMb-P_8FwymMXCYg;=3ALZSqhzU4PdJez9U$hjbhVLIP+$zGO?B9(}Txh8KY> zuz=d)^rz6O{_Ajc0XzEgt}0aNA>V{yRXxH@P&-)t9!op=bx6mN=ZDw-XAp+fed8*b z@KD^qj}sFys3hG6#&s+Wx9uGf*{{dN6@Pc0&EY6KakIRKNz<%UvDn4}0x4B|mT^RU(P08> z8xwmNoQZ8u7)8&x4tf?=l0&SLoQj@8RbjNCybD*Xy19i_xQxy+iKb{d6qan4tT(RB z@dH_LCYjvy=#Is3D)0Ze`rdV6=u%T&+%z&D`lfuA;or=3Yk@$ zzCr6L=I@K=$P$e362Um|Oc#+K5$j`ultPA=lfTMWa8epUZt6}*hBm6bxLI*pNu-~{ zP{<)crM2M;27-k)SBHpA7#z$-1<~EI=-n7I=~3Am3Hs?t7z#Hd*I?wpvjZAVITFuQ z!{f>+`jELRFkv?E-T=GgGDB}E;a#UPHv|`iRP{gZgOS#RM+kNpG^(qHf$&trw@{(j z{22l0DRW&vd$A^RvHHw3RE}|kskf)El2cxC=#o}_oK+tHpura@g$j=?P zwX|YvtQS^FOB=?^)%k*K%s1AT5OP{w8SB^oy&v(RNb!IK2eukm4k+%LpcOKvMNBs} z%Wyqw+kV4=0-iM0Q6Ddia5MzbH1ah_g==Y(Njqf&(bJk4uy@m4sWGn zTJV>~Tv^CudlXg{jb z3mf8J5+u^#O?n$kqC?KdVFbq#QLiqV^}ZCAR5w05#s5HqE6aHOvwhgCJ_3Svg4Fp>fybU+(TFt81m?o-+%sU6?`coQ3GY~nY@igpFX@+60 zm(V|hVa`qn30?9;AZX5~uuw90JL(l}F@r^E{m;OLuQ79v z;ud|#mcT7yW<{i_(feF^;nx)hNl;jlUw+d>K}$MOl3?XRO%AgRX6!n>gl(FWlF>zP zrB35npWYJjtgrvo08F$=^305tY(omqFO7m1J+!<+xR${^$=tK3*~fA-qZk(}f&>{} zx&)9B+M(j6{U$?}Sj8syqqdsN6_2}L#K)q$R^W=S0K8a#I@qNJHkMVqNQ}82jz63l zqY---RM^?le~OW|!{PCIHS|{H6#!Pfb{#Lx>1sHlxbl|(9&PPjjkd(6>n(Q9rtdsnBIfS@e(6ba3dCTGB_Z`t1ZzN zQ700Y!4k9!r!^Zp{rd@+n8)jR%%lR#meKZ6%hmMz3^~rg%?`M}SWMb+XSx-;6*w;L zOcq1blFB5R`!H(Lu?$Dx%acN1c;PT1s=YQ*;Byd(^s|Ciy<+3n9C)WJ<@Z%8ynjx> zprjK;)V1aUi1G{g#nl5i)odn|pd!$^%97IZNcOl*gP;LM>3Qh{aPRqhD3< z`IqksOFa#1^IjZaDDPhoEEIpf)mMPfj-XA4kK1%OGS?FF%Iwczf?rmhoizUii`bH7?MWfF2MpdYp5UU2WZ^usY+gtAvTQ^t z@`@=?cVMP~j?^={EuN!~cmmVI2dVl9UVyQ4aOvlMl!PIKC#!g?Zh7R}kmON{UGtGn zxA^H!1NsL?1@<)Pd;j&{KS0RO9EwB z$iFiK^GAhC3=W)bG+!7nZtmyqGH%%DOjn+;k-8v+LSk;>#E|4Arb`HCa4GA^)d=TG zb|j3YX?^ovlc#tQxm-C^R0l99A8?SEP34&6tD};#M+N@ugE4WN-0HytK_myL^D?XO zNzB`>=BV5~Mvv+wA(+{tf_xLv!i=yMMI`cx5BaeMmqSWw$>Eb2%r1VWWb%V(mhQAb zF#M!Nc3JYUhwQRyHR_WeYRY2_8J>Ldpc@};0X!XZ^U-9wIax6LaSOu_$o-xSOA_Qe zkW?=H<2+LtmLk0z9!2J8_RLyuGrFmsM)waWs_0dIoT#F+Br`FhikmD%^$li%U)LWo z5vht(?66g#Sqx(Qx;5?oq%eWbipzuq_9WH^=n8k1prlvQQwQ`uou`x}kDOA`liX&*`^Ln8_cRazV=$C4WE#r?ujq2);l zV^6xR%1$>GlYc_diXvO#AvAv(Z%@~Vh zddZZ?@_&o0iQFhgVp(gQavauP(ugBSMp9-rH^q%lOo*n-Ha7nN*=)rQV%cn+BH8TZ zBQdr%bxd2sm(}NKzaAIz6g(m>A U~>&VM&6skl>i4Q54#M19l)eiI9wJY~l{V9`op=;~9@EFQCSjR7r-= z440ldeav*GxAxXvI+-5&5A@Pwj_r*Tho15mbb9Ki-IZ*EjUlC6@MyosZ-3uwcON~m zwk&iSd>1PHfL49Bqr#)Ht<-kfGLyW2qVu7xT$y#8oS*s}>ijQZY}J zit96T2x(Q-al{p>j9wuT{=jBc*F?uvUHCVyJ0;!FU0to}p8?`|aYL;-1XPd8ZqyCU z)lEb66mo_}CMHE@(~}*yOxWSP7{Ks04I3_I4VT!4S}iURN3(UyHSIiz%JL?01FF0) z6O-JnXHMS`Cm2RqJ_2%HbnQB6_AZJxaqG4*M{#=w_JUuA!Jrf<}3aX_iG)g(k|LCoz zg$<9_QkfIW1+F&<*qlASG{%=`B|&;7h{w+%!@;8KlfVR|-$JOLRTI8~dc87?2%<1C zknA~7Liir)b$2Zi3Bjk!vp3_+RbxkSrW#)bA&e2KkPTXUrV;7!tl%*;Xp?Q-fs`!i zl}Il&-G89;9Vk6`9*qQxnoXd=lstHmevlfRjRxL$?BhWIJ#anJ9O|WhM^Je6c|KiQ zTVBbhQ`t;5y%0W!htW{JkXy~Aa!aM;S|*b&gav#7^(yOyTsS0W-YO|{gNKG~3!>u0 zp_3&zA9sMXPl)C^iC6sB9`9Q4#i1Q&Px?kc!zqfLX%)z)b;vUO5cONC4MoN290xl8 zQQpJHyPQV-%rIqqa5fTfKwBW>5NDi)=L#BN;vTn@aLGpDMdG$%nQaLyN77~UG1R-Q zlN}!U8=Y{hgN*cxfbf#;aIcO}LFy0%4=4rG=$=+J>lHtXYpS7c!sIvze}W}?VR;Rgabv8vS_%~9qTgh;70mNKv&n{ za0Dl;06epHCIx%Sa7ECy!(dn%N?(Q=OV5boKxO;vo(a$y-W6F;Z$ooFz9l|A2hGTD z&t9`VrbB@25IPUX4G%SKI~Va3xA%=et(B;-)gNt{Ma?&c&9am;w2~%8l z`S$rVz{fxc1_qt-(aFwW14)inrsy6@2^z~2pyLJrWYl`2Ty1;3 z`a@aUa$U=j6N#Oj9S$bAd#QDI3+~2nL729xs=Hy@wW)66%uUiucc{%H+e;3zfWno+ zHS@y9v(&sV1{#S?(|?!(9573mL90CH|M*)FUWcwN(&wmn%0m~=*UKyQa(sQ}jlWPV z(v_n3UIj}Vvj&gZ$=&8i>M@f*V#jR G2>lC@lYv_R literal 0 HcmV?d00001 diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/AcknowledgeRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/AcknowledgeRequest.php new file mode 100644 index 000000000000..bcea3e128240 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/AcknowledgeRequest.php @@ -0,0 +1,132 @@ +google.pubsub.v1.AcknowledgeRequest + */ +class AcknowledgeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The subscription whose message is being acknowledged. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $subscription = ''; + /** + * Required. The acknowledgment ID for the messages being acknowledged that + * was returned by the Pub/Sub system in the `Pull` response. Must not be + * empty. + * + * Generated from protobuf field repeated string ack_ids = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $ack_ids; + + /** + * @param string $subscription Required. The subscription whose message is being acknowledged. + * Format is `projects/{project}/subscriptions/{sub}`. Please see + * {@see SubscriberClient::subscriptionName()} for help formatting this field. + * @param string[] $ackIds Required. The acknowledgment ID for the messages being acknowledged that + * was returned by the Pub/Sub system in the `Pull` response. Must not be + * empty. + * + * @return \Google\Cloud\PubSub\V1\AcknowledgeRequest + * + * @experimental + */ + public static function build(string $subscription, array $ackIds): self + { + return (new self()) + ->setSubscription($subscription) + ->setAckIds($ackIds); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subscription + * Required. The subscription whose message is being acknowledged. + * Format is `projects/{project}/subscriptions/{sub}`. + * @type array|\Google\Protobuf\Internal\RepeatedField $ack_ids + * Required. The acknowledgment ID for the messages being acknowledged that + * was returned by the Pub/Sub system in the `Pull` response. Must not be + * empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The subscription whose message is being acknowledged. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSubscription() + { + return $this->subscription; + } + + /** + * Required. The subscription whose message is being acknowledged. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSubscription($var) + { + GPBUtil::checkString($var, True); + $this->subscription = $var; + + return $this; + } + + /** + * Required. The acknowledgment ID for the messages being acknowledged that + * was returned by the Pub/Sub system in the `Pull` response. Must not be + * empty. + * + * Generated from protobuf field repeated string ack_ids = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAckIds() + { + return $this->ack_ids; + } + + /** + * Required. The acknowledgment ID for the messages being acknowledged that + * was returned by the Pub/Sub system in the `Pull` response. Must not be + * empty. + * + * Generated from protobuf field repeated string ack_ids = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAckIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->ack_ids = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig.php new file mode 100644 index 000000000000..1f206785c596 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig.php @@ -0,0 +1,347 @@ +google.pubsub.v1.BigQueryConfig + */ +class BigQueryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The name of the table to which to write data, of the form + * {projectId}.{datasetId}.{tableId} + * + * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $table = ''; + /** + * Optional. When true, use the topic's schema as the columns to write to in + * BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be + * enabled at the same time. + * + * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $use_topic_schema = false; + /** + * Optional. When true, write the subscription name, message_id, publish_time, + * attributes, and ordering_key to additional columns in the table. The + * subscription name, message_id, and publish_time fields are put in their own + * columns while all other message properties (other than data) are written to + * a JSON object in the attributes column. + * + * Generated from protobuf field bool write_metadata = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $write_metadata = false; + /** + * Optional. When true and use_topic_schema is true, any fields that are a + * part of the topic schema that are not part of the BigQuery table schema are + * dropped when writing to BigQuery. Otherwise, the schemas must be kept in + * sync and any messages with extra fields are not written and remain in the + * subscription's backlog. + * + * Generated from protobuf field bool drop_unknown_fields = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $drop_unknown_fields = false; + /** + * Output only. An output-only field that indicates whether or not the + * subscription can receive messages. + * + * Generated from protobuf field .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Optional. When true, use the BigQuery table's schema as the columns to + * write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be + * enabled at the same time. + * + * Generated from protobuf field bool use_table_schema = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $use_table_schema = false; + /** + * Optional. The service account to use to write to BigQuery. The subscription + * creator or updater that specifies this field must have + * `iam.serviceAccounts.actAs` permission on the service account. If not + * specified, the Pub/Sub [service + * agent](https://cloud.google.com/iam/docs/service-agents), + * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. + * + * Generated from protobuf field string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_account_email = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $table + * Optional. The name of the table to which to write data, of the form + * {projectId}.{datasetId}.{tableId} + * @type bool $use_topic_schema + * Optional. When true, use the topic's schema as the columns to write to in + * BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be + * enabled at the same time. + * @type bool $write_metadata + * Optional. When true, write the subscription name, message_id, publish_time, + * attributes, and ordering_key to additional columns in the table. The + * subscription name, message_id, and publish_time fields are put in their own + * columns while all other message properties (other than data) are written to + * a JSON object in the attributes column. + * @type bool $drop_unknown_fields + * Optional. When true and use_topic_schema is true, any fields that are a + * part of the topic schema that are not part of the BigQuery table schema are + * dropped when writing to BigQuery. Otherwise, the schemas must be kept in + * sync and any messages with extra fields are not written and remain in the + * subscription's backlog. + * @type int $state + * Output only. An output-only field that indicates whether or not the + * subscription can receive messages. + * @type bool $use_table_schema + * Optional. When true, use the BigQuery table's schema as the columns to + * write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be + * enabled at the same time. + * @type string $service_account_email + * Optional. The service account to use to write to BigQuery. The subscription + * creator or updater that specifies this field must have + * `iam.serviceAccounts.actAs` permission on the service account. If not + * specified, the Pub/Sub [service + * agent](https://cloud.google.com/iam/docs/service-agents), + * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The name of the table to which to write data, of the form + * {projectId}.{datasetId}.{tableId} + * + * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Optional. The name of the table to which to write data, of the form + * {projectId}.{datasetId}.{tableId} + * + * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setTable($var) + { + GPBUtil::checkString($var, True); + $this->table = $var; + + return $this; + } + + /** + * Optional. When true, use the topic's schema as the columns to write to in + * BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be + * enabled at the same time. + * + * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getUseTopicSchema() + { + return $this->use_topic_schema; + } + + /** + * Optional. When true, use the topic's schema as the columns to write to in + * BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be + * enabled at the same time. + * + * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setUseTopicSchema($var) + { + GPBUtil::checkBool($var); + $this->use_topic_schema = $var; + + return $this; + } + + /** + * Optional. When true, write the subscription name, message_id, publish_time, + * attributes, and ordering_key to additional columns in the table. The + * subscription name, message_id, and publish_time fields are put in their own + * columns while all other message properties (other than data) are written to + * a JSON object in the attributes column. + * + * Generated from protobuf field bool write_metadata = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getWriteMetadata() + { + return $this->write_metadata; + } + + /** + * Optional. When true, write the subscription name, message_id, publish_time, + * attributes, and ordering_key to additional columns in the table. The + * subscription name, message_id, and publish_time fields are put in their own + * columns while all other message properties (other than data) are written to + * a JSON object in the attributes column. + * + * Generated from protobuf field bool write_metadata = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setWriteMetadata($var) + { + GPBUtil::checkBool($var); + $this->write_metadata = $var; + + return $this; + } + + /** + * Optional. When true and use_topic_schema is true, any fields that are a + * part of the topic schema that are not part of the BigQuery table schema are + * dropped when writing to BigQuery. Otherwise, the schemas must be kept in + * sync and any messages with extra fields are not written and remain in the + * subscription's backlog. + * + * Generated from protobuf field bool drop_unknown_fields = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getDropUnknownFields() + { + return $this->drop_unknown_fields; + } + + /** + * Optional. When true and use_topic_schema is true, any fields that are a + * part of the topic schema that are not part of the BigQuery table schema are + * dropped when writing to BigQuery. Otherwise, the schemas must be kept in + * sync and any messages with extra fields are not written and remain in the + * subscription's backlog. + * + * Generated from protobuf field bool drop_unknown_fields = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setDropUnknownFields($var) + { + GPBUtil::checkBool($var); + $this->drop_unknown_fields = $var; + + return $this; + } + + /** + * Output only. An output-only field that indicates whether or not the + * subscription can receive messages. + * + * Generated from protobuf field .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. An output-only field that indicates whether or not the + * subscription can receive messages. + * + * Generated from protobuf field .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\BigQueryConfig\State::class); + $this->state = $var; + + return $this; + } + + /** + * Optional. When true, use the BigQuery table's schema as the columns to + * write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be + * enabled at the same time. + * + * Generated from protobuf field bool use_table_schema = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getUseTableSchema() + { + return $this->use_table_schema; + } + + /** + * Optional. When true, use the BigQuery table's schema as the columns to + * write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be + * enabled at the same time. + * + * Generated from protobuf field bool use_table_schema = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setUseTableSchema($var) + { + GPBUtil::checkBool($var); + $this->use_table_schema = $var; + + return $this; + } + + /** + * Optional. The service account to use to write to BigQuery. The subscription + * creator or updater that specifies this field must have + * `iam.serviceAccounts.actAs` permission on the service account. If not + * specified, the Pub/Sub [service + * agent](https://cloud.google.com/iam/docs/service-agents), + * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. + * + * Generated from protobuf field string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getServiceAccountEmail() + { + return $this->service_account_email; + } + + /** + * Optional. The service account to use to write to BigQuery. The subscription + * creator or updater that specifies this field must have + * `iam.serviceAccounts.actAs` permission on the service account. If not + * specified, the Pub/Sub [service + * agent](https://cloud.google.com/iam/docs/service-agents), + * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. + * + * Generated from protobuf field string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setServiceAccountEmail($var) + { + GPBUtil::checkString($var, True); + $this->service_account_email = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig/State.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig/State.php new file mode 100644 index 000000000000..e92d03742eba --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig/State.php @@ -0,0 +1,91 @@ +google.pubsub.v1.BigQueryConfig.State + */ +class State +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The subscription can actively send messages to BigQuery + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Cannot write to the BigQuery table because of permission denied errors. + * This can happen if + * - Pub/Sub SA has not been granted the [appropriate BigQuery IAM + * permissions](https://cloud.google.com/pubsub/docs/create-subscription#assign_bigquery_service_account) + * - bigquery.googleapis.com API is not enabled for the project + * ([instructions](https://cloud.google.com/service-usage/docs/enable-disable)) + * + * Generated from protobuf enum PERMISSION_DENIED = 2; + */ + const PERMISSION_DENIED = 2; + /** + * Cannot write to the BigQuery table because it does not exist. + * + * Generated from protobuf enum NOT_FOUND = 3; + */ + const NOT_FOUND = 3; + /** + * Cannot write to the BigQuery table due to a schema mismatch. + * + * Generated from protobuf enum SCHEMA_MISMATCH = 4; + */ + const SCHEMA_MISMATCH = 4; + /** + * Cannot write to the destination because enforce_in_transit is set to true + * and the destination locations are not in the allowed regions. + * + * Generated from protobuf enum IN_TRANSIT_LOCATION_RESTRICTION = 5; + */ + const IN_TRANSIT_LOCATION_RESTRICTION = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::PERMISSION_DENIED => 'PERMISSION_DENIED', + self::NOT_FOUND => 'NOT_FOUND', + self::SCHEMA_MISMATCH => 'SCHEMA_MISMATCH', + self::IN_TRANSIT_LOCATION_RESTRICTION => 'IN_TRANSIT_LOCATION_RESTRICTION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\PubSub\V1\BigQueryConfig_State::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig.php new file mode 100644 index 000000000000..4c98327fa852 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig.php @@ -0,0 +1,468 @@ +google.pubsub.v1.CloudStorageConfig + */ +class CloudStorageConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. User-provided name for the Cloud Storage bucket. + * The bucket must be created by the user. The bucket name must be without + * any prefix like "gs://". See the [bucket naming + * requirements] (https://cloud.google.com/storage/docs/buckets#naming). + * + * Generated from protobuf field string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $bucket = ''; + /** + * Optional. User-provided prefix for Cloud Storage filename. See the [object + * naming requirements](https://cloud.google.com/storage/docs/objects#naming). + * + * Generated from protobuf field string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filename_prefix = ''; + /** + * Optional. User-provided suffix for Cloud Storage filename. See the [object + * naming requirements](https://cloud.google.com/storage/docs/objects#naming). + * Must not end in "/". + * + * Generated from protobuf field string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filename_suffix = ''; + /** + * Optional. User-provided format string specifying how to represent datetimes + * in Cloud Storage filenames. See the [datetime format + * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names). + * + * Generated from protobuf field string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filename_datetime_format = ''; + /** + * Optional. The maximum duration that can elapse before a new Cloud Storage + * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not + * exceed the subscription's acknowledgement deadline. + * + * Generated from protobuf field .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $max_duration = null; + /** + * Optional. The maximum bytes that can be written to a Cloud Storage file + * before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may + * be exceeded in cases where messages are larger than the limit. + * + * Generated from protobuf field int64 max_bytes = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $max_bytes = 0; + /** + * Output only. An output-only field that indicates whether or not the + * subscription can receive messages. + * + * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Optional. The service account to use to write to Cloud Storage. The + * subscription creator or updater that specifies this field must have + * `iam.serviceAccounts.actAs` permission on the service account. If not + * specified, the Pub/Sub + * [service agent](https://cloud.google.com/iam/docs/service-agents), + * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. + * + * Generated from protobuf field string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_account_email = ''; + protected $output_format; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $bucket + * Required. User-provided name for the Cloud Storage bucket. + * The bucket must be created by the user. The bucket name must be without + * any prefix like "gs://". See the [bucket naming + * requirements] (https://cloud.google.com/storage/docs/buckets#naming). + * @type string $filename_prefix + * Optional. User-provided prefix for Cloud Storage filename. See the [object + * naming requirements](https://cloud.google.com/storage/docs/objects#naming). + * @type string $filename_suffix + * Optional. User-provided suffix for Cloud Storage filename. See the [object + * naming requirements](https://cloud.google.com/storage/docs/objects#naming). + * Must not end in "/". + * @type string $filename_datetime_format + * Optional. User-provided format string specifying how to represent datetimes + * in Cloud Storage filenames. See the [datetime format + * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names). + * @type \Google\Cloud\PubSub\V1\CloudStorageConfig\TextConfig $text_config + * Optional. If set, message data will be written to Cloud Storage in text + * format. + * @type \Google\Cloud\PubSub\V1\CloudStorageConfig\AvroConfig $avro_config + * Optional. If set, message data will be written to Cloud Storage in Avro + * format. + * @type \Google\Protobuf\Duration $max_duration + * Optional. The maximum duration that can elapse before a new Cloud Storage + * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not + * exceed the subscription's acknowledgement deadline. + * @type int|string $max_bytes + * Optional. The maximum bytes that can be written to a Cloud Storage file + * before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may + * be exceeded in cases where messages are larger than the limit. + * @type int $state + * Output only. An output-only field that indicates whether or not the + * subscription can receive messages. + * @type string $service_account_email + * Optional. The service account to use to write to Cloud Storage. The + * subscription creator or updater that specifies this field must have + * `iam.serviceAccounts.actAs` permission on the service account. If not + * specified, the Pub/Sub + * [service agent](https://cloud.google.com/iam/docs/service-agents), + * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. User-provided name for the Cloud Storage bucket. + * The bucket must be created by the user. The bucket name must be without + * any prefix like "gs://". See the [bucket naming + * requirements] (https://cloud.google.com/storage/docs/buckets#naming). + * + * Generated from protobuf field string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getBucket() + { + return $this->bucket; + } + + /** + * Required. User-provided name for the Cloud Storage bucket. + * The bucket must be created by the user. The bucket name must be without + * any prefix like "gs://". See the [bucket naming + * requirements] (https://cloud.google.com/storage/docs/buckets#naming). + * + * Generated from protobuf field string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setBucket($var) + { + GPBUtil::checkString($var, True); + $this->bucket = $var; + + return $this; + } + + /** + * Optional. User-provided prefix for Cloud Storage filename. See the [object + * naming requirements](https://cloud.google.com/storage/docs/objects#naming). + * + * Generated from protobuf field string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilenamePrefix() + { + return $this->filename_prefix; + } + + /** + * Optional. User-provided prefix for Cloud Storage filename. See the [object + * naming requirements](https://cloud.google.com/storage/docs/objects#naming). + * + * Generated from protobuf field string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilenamePrefix($var) + { + GPBUtil::checkString($var, True); + $this->filename_prefix = $var; + + return $this; + } + + /** + * Optional. User-provided suffix for Cloud Storage filename. See the [object + * naming requirements](https://cloud.google.com/storage/docs/objects#naming). + * Must not end in "/". + * + * Generated from protobuf field string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilenameSuffix() + { + return $this->filename_suffix; + } + + /** + * Optional. User-provided suffix for Cloud Storage filename. See the [object + * naming requirements](https://cloud.google.com/storage/docs/objects#naming). + * Must not end in "/". + * + * Generated from protobuf field string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilenameSuffix($var) + { + GPBUtil::checkString($var, True); + $this->filename_suffix = $var; + + return $this; + } + + /** + * Optional. User-provided format string specifying how to represent datetimes + * in Cloud Storage filenames. See the [datetime format + * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names). + * + * Generated from protobuf field string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilenameDatetimeFormat() + { + return $this->filename_datetime_format; + } + + /** + * Optional. User-provided format string specifying how to represent datetimes + * in Cloud Storage filenames. See the [datetime format + * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names). + * + * Generated from protobuf field string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilenameDatetimeFormat($var) + { + GPBUtil::checkString($var, True); + $this->filename_datetime_format = $var; + + return $this; + } + + /** + * Optional. If set, message data will be written to Cloud Storage in text + * format. + * + * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\CloudStorageConfig\TextConfig|null + */ + public function getTextConfig() + { + return $this->readOneof(4); + } + + public function hasTextConfig() + { + return $this->hasOneof(4); + } + + /** + * Optional. If set, message data will be written to Cloud Storage in text + * format. + * + * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\CloudStorageConfig\TextConfig $var + * @return $this + */ + public function setTextConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\CloudStorageConfig\TextConfig::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Optional. If set, message data will be written to Cloud Storage in Avro + * format. + * + * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\CloudStorageConfig\AvroConfig|null + */ + public function getAvroConfig() + { + return $this->readOneof(5); + } + + public function hasAvroConfig() + { + return $this->hasOneof(5); + } + + /** + * Optional. If set, message data will be written to Cloud Storage in Avro + * format. + * + * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\CloudStorageConfig\AvroConfig $var + * @return $this + */ + public function setAvroConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\CloudStorageConfig\AvroConfig::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Optional. The maximum duration that can elapse before a new Cloud Storage + * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not + * exceed the subscription's acknowledgement deadline. + * + * Generated from protobuf field .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getMaxDuration() + { + return $this->max_duration; + } + + public function hasMaxDuration() + { + return isset($this->max_duration); + } + + public function clearMaxDuration() + { + unset($this->max_duration); + } + + /** + * Optional. The maximum duration that can elapse before a new Cloud Storage + * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not + * exceed the subscription's acknowledgement deadline. + * + * Generated from protobuf field .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMaxDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->max_duration = $var; + + return $this; + } + + /** + * Optional. The maximum bytes that can be written to a Cloud Storage file + * before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may + * be exceeded in cases where messages are larger than the limit. + * + * Generated from protobuf field int64 max_bytes = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return int|string + */ + public function getMaxBytes() + { + return $this->max_bytes; + } + + /** + * Optional. The maximum bytes that can be written to a Cloud Storage file + * before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may + * be exceeded in cases where messages are larger than the limit. + * + * Generated from protobuf field int64 max_bytes = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param int|string $var + * @return $this + */ + public function setMaxBytes($var) + { + GPBUtil::checkInt64($var); + $this->max_bytes = $var; + + return $this; + } + + /** + * Output only. An output-only field that indicates whether or not the + * subscription can receive messages. + * + * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. An output-only field that indicates whether or not the + * subscription can receive messages. + * + * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\CloudStorageConfig\State::class); + $this->state = $var; + + return $this; + } + + /** + * Optional. The service account to use to write to Cloud Storage. The + * subscription creator or updater that specifies this field must have + * `iam.serviceAccounts.actAs` permission on the service account. If not + * specified, the Pub/Sub + * [service agent](https://cloud.google.com/iam/docs/service-agents), + * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. + * + * Generated from protobuf field string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getServiceAccountEmail() + { + return $this->service_account_email; + } + + /** + * Optional. The service account to use to write to Cloud Storage. The + * subscription creator or updater that specifies this field must have + * `iam.serviceAccounts.actAs` permission on the service account. If not + * specified, the Pub/Sub + * [service agent](https://cloud.google.com/iam/docs/service-agents), + * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. + * + * Generated from protobuf field string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setServiceAccountEmail($var) + { + GPBUtil::checkString($var, True); + $this->service_account_email = $var; + + return $this; + } + + /** + * @return string + */ + public function getOutputFormat() + { + return $this->whichOneof("output_format"); + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/AvroConfig.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/AvroConfig.php new file mode 100644 index 000000000000..03971b1d3dc5 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/AvroConfig.php @@ -0,0 +1,129 @@ +google.pubsub.v1.CloudStorageConfig.AvroConfig + */ +class AvroConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. When true, write the subscription name, message_id, + * publish_time, attributes, and ordering_key as additional fields in the + * output. The subscription name, message_id, and publish_time fields are + * put in their own fields while all other message properties other than + * data (for example, an ordering_key, if present) are added as entries in + * the attributes map. + * + * Generated from protobuf field bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $write_metadata = false; + /** + * Optional. When true, the output Cloud Storage file will be serialized + * using the topic schema, if it exists. + * + * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $use_topic_schema = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $write_metadata + * Optional. When true, write the subscription name, message_id, + * publish_time, attributes, and ordering_key as additional fields in the + * output. The subscription name, message_id, and publish_time fields are + * put in their own fields while all other message properties other than + * data (for example, an ordering_key, if present) are added as entries in + * the attributes map. + * @type bool $use_topic_schema + * Optional. When true, the output Cloud Storage file will be serialized + * using the topic schema, if it exists. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. When true, write the subscription name, message_id, + * publish_time, attributes, and ordering_key as additional fields in the + * output. The subscription name, message_id, and publish_time fields are + * put in their own fields while all other message properties other than + * data (for example, an ordering_key, if present) are added as entries in + * the attributes map. + * + * Generated from protobuf field bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getWriteMetadata() + { + return $this->write_metadata; + } + + /** + * Optional. When true, write the subscription name, message_id, + * publish_time, attributes, and ordering_key as additional fields in the + * output. The subscription name, message_id, and publish_time fields are + * put in their own fields while all other message properties other than + * data (for example, an ordering_key, if present) are added as entries in + * the attributes map. + * + * Generated from protobuf field bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setWriteMetadata($var) + { + GPBUtil::checkBool($var); + $this->write_metadata = $var; + + return $this; + } + + /** + * Optional. When true, the output Cloud Storage file will be serialized + * using the topic schema, if it exists. + * + * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getUseTopicSchema() + { + return $this->use_topic_schema; + } + + /** + * Optional. When true, the output Cloud Storage file will be serialized + * using the topic schema, if it exists. + * + * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setUseTopicSchema($var) + { + GPBUtil::checkBool($var); + $this->use_topic_schema = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AvroConfig::class, \Google\Cloud\PubSub\V1\CloudStorageConfig_AvroConfig::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/State.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/State.php new file mode 100644 index 000000000000..394d25dbcc1e --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/State.php @@ -0,0 +1,88 @@ +google.pubsub.v1.CloudStorageConfig.State + */ +class State +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The subscription can actively send messages to Cloud Storage. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Cannot write to the Cloud Storage bucket because of permission denied + * errors. + * + * Generated from protobuf enum PERMISSION_DENIED = 2; + */ + const PERMISSION_DENIED = 2; + /** + * Cannot write to the Cloud Storage bucket because it does not exist. + * + * Generated from protobuf enum NOT_FOUND = 3; + */ + const NOT_FOUND = 3; + /** + * Cannot write to the destination because enforce_in_transit is set to true + * and the destination locations are not in the allowed regions. + * + * Generated from protobuf enum IN_TRANSIT_LOCATION_RESTRICTION = 4; + */ + const IN_TRANSIT_LOCATION_RESTRICTION = 4; + /** + * Cannot write to the Cloud Storage bucket due to an incompatibility + * between the topic schema and subscription settings. + * + * Generated from protobuf enum SCHEMA_MISMATCH = 5; + */ + const SCHEMA_MISMATCH = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::PERMISSION_DENIED => 'PERMISSION_DENIED', + self::NOT_FOUND => 'NOT_FOUND', + self::IN_TRANSIT_LOCATION_RESTRICTION => 'IN_TRANSIT_LOCATION_RESTRICTION', + self::SCHEMA_MISMATCH => 'SCHEMA_MISMATCH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\PubSub\V1\CloudStorageConfig_State::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/TextConfig.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/TextConfig.php new file mode 100644 index 000000000000..b76638c31137 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/TextConfig.php @@ -0,0 +1,38 @@ +google.pubsub.v1.CloudStorageConfig.TextConfig + */ +class TextConfig extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TextConfig::class, \Google\Cloud\PubSub\V1\CloudStorageConfig_TextConfig::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CommitSchemaRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CommitSchemaRequest.php new file mode 100644 index 000000000000..29f01208b3c5 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CommitSchemaRequest.php @@ -0,0 +1,132 @@ +google.pubsub.v1.CommitSchemaRequest + */ +class CommitSchemaRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the schema we are revising. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The schema revision to commit. + * + * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $schema = null; + + /** + * @param string $name Required. The name of the schema we are revising. + * Format is `projects/{project}/schemas/{schema}`. Please see + * {@see SchemaServiceClient::schemaName()} for help formatting this field. + * @param \Google\Cloud\PubSub\V1\Schema $schema Required. The schema revision to commit. + * + * @return \Google\Cloud\PubSub\V1\CommitSchemaRequest + * + * @experimental + */ + public static function build(string $name, \Google\Cloud\PubSub\V1\Schema $schema): self + { + return (new self()) + ->setName($name) + ->setSchema($schema); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the schema we are revising. + * Format is `projects/{project}/schemas/{schema}`. + * @type \Google\Cloud\PubSub\V1\Schema $schema + * Required. The schema revision to commit. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the schema we are revising. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the schema we are revising. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The schema revision to commit. + * + * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\PubSub\V1\Schema|null + */ + public function getSchema() + { + return $this->schema; + } + + public function hasSchema() + { + return isset($this->schema); + } + + public function clearSchema() + { + unset($this->schema); + } + + /** + * Required. The schema revision to commit. + * + * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\PubSub\V1\Schema $var + * @return $this + */ + public function setSchema($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Schema::class); + $this->schema = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSchemaRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSchemaRequest.php new file mode 100644 index 000000000000..486fe277daa7 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSchemaRequest.php @@ -0,0 +1,200 @@ +google.pubsub.v1.CreateSchemaRequest + */ +class CreateSchemaRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project in which to create the schema. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The schema object to create. + * This schema's `name` parameter is ignored. The schema object returned + * by CreateSchema will have a `name` made using the given `parent` and + * `schema_id`. + * + * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $schema = null; + /** + * The ID to use for the schema, which will become the final component of + * the schema's resource name. + * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for + * resource name constraints. + * + * Generated from protobuf field string schema_id = 3; + */ + protected $schema_id = ''; + + /** + * @param string $parent Required. The name of the project in which to create the schema. + * Format is `projects/{project-id}`. Please see + * {@see SchemaServiceClient::projectName()} for help formatting this field. + * @param \Google\Cloud\PubSub\V1\Schema $schema Required. The schema object to create. + * + * This schema's `name` parameter is ignored. The schema object returned + * by CreateSchema will have a `name` made using the given `parent` and + * `schema_id`. + * @param string $schemaId The ID to use for the schema, which will become the final component of + * the schema's resource name. + * + * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for + * resource name constraints. + * + * @return \Google\Cloud\PubSub\V1\CreateSchemaRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\PubSub\V1\Schema $schema, string $schemaId): self + { + return (new self()) + ->setParent($parent) + ->setSchema($schema) + ->setSchemaId($schemaId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the project in which to create the schema. + * Format is `projects/{project-id}`. + * @type \Google\Cloud\PubSub\V1\Schema $schema + * Required. The schema object to create. + * This schema's `name` parameter is ignored. The schema object returned + * by CreateSchema will have a `name` made using the given `parent` and + * `schema_id`. + * @type string $schema_id + * The ID to use for the schema, which will become the final component of + * the schema's resource name. + * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for + * resource name constraints. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project in which to create the schema. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the project in which to create the schema. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The schema object to create. + * This schema's `name` parameter is ignored. The schema object returned + * by CreateSchema will have a `name` made using the given `parent` and + * `schema_id`. + * + * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\PubSub\V1\Schema|null + */ + public function getSchema() + { + return $this->schema; + } + + public function hasSchema() + { + return isset($this->schema); + } + + public function clearSchema() + { + unset($this->schema); + } + + /** + * Required. The schema object to create. + * This schema's `name` parameter is ignored. The schema object returned + * by CreateSchema will have a `name` made using the given `parent` and + * `schema_id`. + * + * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\PubSub\V1\Schema $var + * @return $this + */ + public function setSchema($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Schema::class); + $this->schema = $var; + + return $this; + } + + /** + * The ID to use for the schema, which will become the final component of + * the schema's resource name. + * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for + * resource name constraints. + * + * Generated from protobuf field string schema_id = 3; + * @return string + */ + public function getSchemaId() + { + return $this->schema_id; + } + + /** + * The ID to use for the schema, which will become the final component of + * the schema's resource name. + * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for + * resource name constraints. + * + * Generated from protobuf field string schema_id = 3; + * @param string $var + * @return $this + */ + public function setSchemaId($var) + { + GPBUtil::checkString($var, True); + $this->schema_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSnapshotRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSnapshotRequest.php new file mode 100644 index 000000000000..d886092613fc --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSnapshotRequest.php @@ -0,0 +1,221 @@ +google.pubsub.v1.CreateSnapshotRequest + */ +class CreateSnapshotRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. User-provided name for this snapshot. If the name is not provided + * in the request, the server will assign a random name for this snapshot on + * the same project as the subscription. Note that for REST API requests, you + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: + * (a) The existing backlog on the subscription. More precisely, this is + * defined as the messages in the subscription's backlog that are + * unacknowledged upon the successful completion of the + * `CreateSnapshot` request; as well as: + * (b) Any messages published to the subscription's topic following the + * successful completion of the CreateSnapshot request. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $subscription = ''; + /** + * Optional. See [Creating and managing + * labels](https://cloud.google.com/pubsub/docs/labels). + * + * Generated from protobuf field map labels = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + + /** + * @param string $name Required. User-provided name for this snapshot. If the name is not provided + * in the request, the server will assign a random name for this snapshot on + * the same project as the subscription. Note that for REST API requests, you + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. Please see + * {@see SubscriberClient::snapshotName()} for help formatting this field. + * @param string $subscription Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: + * (a) The existing backlog on the subscription. More precisely, this is + * defined as the messages in the subscription's backlog that are + * unacknowledged upon the successful completion of the + * `CreateSnapshot` request; as well as: + * (b) Any messages published to the subscription's topic following the + * successful completion of the CreateSnapshot request. + * Format is `projects/{project}/subscriptions/{sub}`. Please see + * {@see SubscriberClient::subscriptionName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\CreateSnapshotRequest + * + * @experimental + */ + public static function build(string $name, string $subscription): self + { + return (new self()) + ->setName($name) + ->setSubscription($subscription); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. User-provided name for this snapshot. If the name is not provided + * in the request, the server will assign a random name for this snapshot on + * the same project as the subscription. Note that for REST API requests, you + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. + * @type string $subscription + * Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: + * (a) The existing backlog on the subscription. More precisely, this is + * defined as the messages in the subscription's backlog that are + * unacknowledged upon the successful completion of the + * `CreateSnapshot` request; as well as: + * (b) Any messages published to the subscription's topic following the + * successful completion of the CreateSnapshot request. + * Format is `projects/{project}/subscriptions/{sub}`. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. See [Creating and managing + * labels](https://cloud.google.com/pubsub/docs/labels). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. User-provided name for this snapshot. If the name is not provided + * in the request, the server will assign a random name for this snapshot on + * the same project as the subscription. Note that for REST API requests, you + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. User-provided name for this snapshot. If the name is not provided + * in the request, the server will assign a random name for this snapshot on + * the same project as the subscription. Note that for REST API requests, you + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: + * (a) The existing backlog on the subscription. More precisely, this is + * defined as the messages in the subscription's backlog that are + * unacknowledged upon the successful completion of the + * `CreateSnapshot` request; as well as: + * (b) Any messages published to the subscription's topic following the + * successful completion of the CreateSnapshot request. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSubscription() + { + return $this->subscription; + } + + /** + * Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: + * (a) The existing backlog on the subscription. More precisely, this is + * defined as the messages in the subscription's backlog that are + * unacknowledged upon the successful completion of the + * `CreateSnapshot` request; as well as: + * (b) Any messages published to the subscription's topic following the + * successful completion of the CreateSnapshot request. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSubscription($var) + { + GPBUtil::checkString($var, True); + $this->subscription = $var; + + return $this; + } + + /** + * Optional. See [Creating and managing + * labels](https://cloud.google.com/pubsub/docs/labels). + * + * Generated from protobuf field map labels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. See [Creating and managing + * labels](https://cloud.google.com/pubsub/docs/labels). + * + * Generated from protobuf field map labels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeadLetterPolicy.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeadLetterPolicy.php new file mode 100644 index 000000000000..b7286c36759b --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeadLetterPolicy.php @@ -0,0 +1,164 @@ +google.pubsub.v1.DeadLetterPolicy + */ +class DeadLetterPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The name of the topic to which dead letter messages should be + * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub + * service account associated with the enclosing subscription's parent project + * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must + * have permission to Publish() to this topic. + * The operation will fail if the topic does not exist. + * Users should ensure that there is a subscription attached to this topic + * since messages published to a topic with no subscriptions are lost. + * + * Generated from protobuf field string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $dead_letter_topic = ''; + /** + * Optional. The maximum number of delivery attempts for any message. The + * value must be between 5 and 100. + * The number of delivery attempts is defined as 1 + (the sum of number of + * NACKs and number of times the acknowledgement deadline has been exceeded + * for the message). + * A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that + * client libraries may automatically extend ack_deadlines. + * This field will be honored on a best effort basis. + * If this parameter is 0, a default value of 5 is used. + * + * Generated from protobuf field int32 max_delivery_attempts = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $max_delivery_attempts = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $dead_letter_topic + * Optional. The name of the topic to which dead letter messages should be + * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub + * service account associated with the enclosing subscription's parent project + * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must + * have permission to Publish() to this topic. + * The operation will fail if the topic does not exist. + * Users should ensure that there is a subscription attached to this topic + * since messages published to a topic with no subscriptions are lost. + * @type int $max_delivery_attempts + * Optional. The maximum number of delivery attempts for any message. The + * value must be between 5 and 100. + * The number of delivery attempts is defined as 1 + (the sum of number of + * NACKs and number of times the acknowledgement deadline has been exceeded + * for the message). + * A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that + * client libraries may automatically extend ack_deadlines. + * This field will be honored on a best effort basis. + * If this parameter is 0, a default value of 5 is used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The name of the topic to which dead letter messages should be + * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub + * service account associated with the enclosing subscription's parent project + * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must + * have permission to Publish() to this topic. + * The operation will fail if the topic does not exist. + * Users should ensure that there is a subscription attached to this topic + * since messages published to a topic with no subscriptions are lost. + * + * Generated from protobuf field string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDeadLetterTopic() + { + return $this->dead_letter_topic; + } + + /** + * Optional. The name of the topic to which dead letter messages should be + * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub + * service account associated with the enclosing subscription's parent project + * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must + * have permission to Publish() to this topic. + * The operation will fail if the topic does not exist. + * Users should ensure that there is a subscription attached to this topic + * since messages published to a topic with no subscriptions are lost. + * + * Generated from protobuf field string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDeadLetterTopic($var) + { + GPBUtil::checkString($var, True); + $this->dead_letter_topic = $var; + + return $this; + } + + /** + * Optional. The maximum number of delivery attempts for any message. The + * value must be between 5 and 100. + * The number of delivery attempts is defined as 1 + (the sum of number of + * NACKs and number of times the acknowledgement deadline has been exceeded + * for the message). + * A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that + * client libraries may automatically extend ack_deadlines. + * This field will be honored on a best effort basis. + * If this parameter is 0, a default value of 5 is used. + * + * Generated from protobuf field int32 max_delivery_attempts = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getMaxDeliveryAttempts() + { + return $this->max_delivery_attempts; + } + + /** + * Optional. The maximum number of delivery attempts for any message. The + * value must be between 5 and 100. + * The number of delivery attempts is defined as 1 + (the sum of number of + * NACKs and number of times the acknowledgement deadline has been exceeded + * for the message). + * A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that + * client libraries may automatically extend ack_deadlines. + * This field will be honored on a best effort basis. + * If this parameter is 0, a default value of 5 is used. + * + * Generated from protobuf field int32 max_delivery_attempts = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setMaxDeliveryAttempts($var) + { + GPBUtil::checkInt32($var); + $this->max_delivery_attempts = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRequest.php new file mode 100644 index 000000000000..ff8bdac822d5 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRequest.php @@ -0,0 +1,86 @@ +google.pubsub.v1.DeleteSchemaRequest + */ +class DeleteSchemaRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the schema to delete. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the schema to delete. + * Format is `projects/{project}/schemas/{schema}`. Please see + * {@see SchemaServiceClient::schemaName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\DeleteSchemaRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the schema to delete. + * Format is `projects/{project}/schemas/{schema}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the schema to delete. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the schema to delete. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRevisionRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRevisionRequest.php new file mode 100644 index 000000000000..fdb3da46606f --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRevisionRequest.php @@ -0,0 +1,143 @@ +google.pubsub.v1.DeleteSchemaRevisionRequest + */ +class DeleteSchemaRevisionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the schema revision to be deleted, with a revision ID + * explicitly included. + * Example: `projects/123/schemas/my-schema@c7cfa2a8` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. This field is deprecated and should not be used for specifying + * the revision ID. The revision ID should be specified via the `name` + * parameter. + * + * Generated from protobuf field string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @deprecated + */ + protected $revision_id = ''; + + /** + * @param string $name Required. The name of the schema revision to be deleted, with a revision ID + * explicitly included. + * + * Example: `projects/123/schemas/my-schema@c7cfa2a8` + * Please see {@see SchemaServiceClient::schemaName()} for help formatting this field. + * @param string $revisionId Optional. This field is deprecated and should not be used for specifying + * the revision ID. The revision ID should be specified via the `name` + * parameter. + * + * @return \Google\Cloud\PubSub\V1\DeleteSchemaRevisionRequest + * + * @experimental + */ + public static function build(string $name, string $revisionId): self + { + return (new self()) + ->setName($name) + ->setRevisionId($revisionId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the schema revision to be deleted, with a revision ID + * explicitly included. + * Example: `projects/123/schemas/my-schema@c7cfa2a8` + * @type string $revision_id + * Optional. This field is deprecated and should not be used for specifying + * the revision ID. The revision ID should be specified via the `name` + * parameter. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the schema revision to be deleted, with a revision ID + * explicitly included. + * Example: `projects/123/schemas/my-schema@c7cfa2a8` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the schema revision to be deleted, with a revision ID + * explicitly included. + * Example: `projects/123/schemas/my-schema@c7cfa2a8` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. This field is deprecated and should not be used for specifying + * the revision ID. The revision ID should be specified via the `name` + * parameter. + * + * Generated from protobuf field string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @return string + * @deprecated + */ + public function getRevisionId() + { + @trigger_error('revision_id is deprecated.', E_USER_DEPRECATED); + return $this->revision_id; + } + + /** + * Optional. This field is deprecated and should not be used for specifying + * the revision ID. The revision ID should be specified via the `name` + * parameter. + * + * Generated from protobuf field string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + * @deprecated + */ + public function setRevisionId($var) + { + @trigger_error('revision_id is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkString($var, True); + $this->revision_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSnapshotRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSnapshotRequest.php new file mode 100644 index 000000000000..3b766a683419 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSnapshotRequest.php @@ -0,0 +1,86 @@ +google.pubsub.v1.DeleteSnapshotRequest + */ +class DeleteSnapshotRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the snapshot to delete. + * Format is `projects/{project}/snapshots/{snap}`. + * + * Generated from protobuf field string snapshot = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $snapshot = ''; + + /** + * @param string $snapshot Required. The name of the snapshot to delete. + * Format is `projects/{project}/snapshots/{snap}`. Please see + * {@see SubscriberClient::snapshotName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\DeleteSnapshotRequest + * + * @experimental + */ + public static function build(string $snapshot): self + { + return (new self()) + ->setSnapshot($snapshot); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $snapshot + * Required. The name of the snapshot to delete. + * Format is `projects/{project}/snapshots/{snap}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the snapshot to delete. + * Format is `projects/{project}/snapshots/{snap}`. + * + * Generated from protobuf field string snapshot = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSnapshot() + { + return $this->snapshot; + } + + /** + * Required. The name of the snapshot to delete. + * Format is `projects/{project}/snapshots/{snap}`. + * + * Generated from protobuf field string snapshot = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSnapshot($var) + { + GPBUtil::checkString($var, True); + $this->snapshot = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSubscriptionRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSubscriptionRequest.php new file mode 100644 index 000000000000..9bef784bfab3 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSubscriptionRequest.php @@ -0,0 +1,86 @@ +google.pubsub.v1.DeleteSubscriptionRequest + */ +class DeleteSubscriptionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The subscription to delete. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $subscription = ''; + + /** + * @param string $subscription Required. The subscription to delete. + * Format is `projects/{project}/subscriptions/{sub}`. Please see + * {@see SubscriberClient::subscriptionName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\DeleteSubscriptionRequest + * + * @experimental + */ + public static function build(string $subscription): self + { + return (new self()) + ->setSubscription($subscription); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subscription + * Required. The subscription to delete. + * Format is `projects/{project}/subscriptions/{sub}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The subscription to delete. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSubscription() + { + return $this->subscription; + } + + /** + * Required. The subscription to delete. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSubscription($var) + { + GPBUtil::checkString($var, True); + $this->subscription = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteTopicRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteTopicRequest.php new file mode 100644 index 000000000000..bdd8fbafdf8f --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteTopicRequest.php @@ -0,0 +1,86 @@ +google.pubsub.v1.DeleteTopicRequest + */ +class DeleteTopicRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the topic to delete. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $topic = ''; + + /** + * @param string $topic Required. Name of the topic to delete. + * Format is `projects/{project}/topics/{topic}`. Please see + * {@see PublisherClient::topicName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\DeleteTopicRequest + * + * @experimental + */ + public static function build(string $topic): self + { + return (new self()) + ->setTopic($topic); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $topic + * Required. Name of the topic to delete. + * Format is `projects/{project}/topics/{topic}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the topic to delete. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getTopic() + { + return $this->topic; + } + + /** + * Required. Name of the topic to delete. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTopic($var) + { + GPBUtil::checkString($var, True); + $this->topic = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionRequest.php new file mode 100644 index 000000000000..4279c67be0e4 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionRequest.php @@ -0,0 +1,71 @@ +google.pubsub.v1.DetachSubscriptionRequest + */ +class DetachSubscriptionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The subscription to detach. + * Format is `projects/{project}/subscriptions/{subscription}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $subscription = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subscription + * Required. The subscription to detach. + * Format is `projects/{project}/subscriptions/{subscription}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The subscription to detach. + * Format is `projects/{project}/subscriptions/{subscription}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSubscription() + { + return $this->subscription; + } + + /** + * Required. The subscription to detach. + * Format is `projects/{project}/subscriptions/{subscription}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSubscription($var) + { + GPBUtil::checkString($var, True); + $this->subscription = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionResponse.php new file mode 100644 index 000000000000..99d903a39c5d --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionResponse.php @@ -0,0 +1,34 @@ +google.pubsub.v1.DetachSubscriptionResponse + */ +class DetachSubscriptionResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Encoding.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Encoding.php new file mode 100644 index 000000000000..44b74224b4ab --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Encoding.php @@ -0,0 +1,62 @@ +google.pubsub.v1.Encoding + */ +class Encoding +{ + /** + * Unspecified + * + * Generated from protobuf enum ENCODING_UNSPECIFIED = 0; + */ + const ENCODING_UNSPECIFIED = 0; + /** + * JSON encoding + * + * Generated from protobuf enum JSON = 1; + */ + const JSON = 1; + /** + * Binary encoding, as defined by the schema type. For some schema types, + * binary encoding may not be available. + * + * Generated from protobuf enum BINARY = 2; + */ + const BINARY = 2; + + private static $valueToName = [ + self::ENCODING_UNSPECIFIED => 'ENCODING_UNSPECIFIED', + self::JSON => 'JSON', + self::BINARY => 'BINARY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ExpirationPolicy.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ExpirationPolicy.php new file mode 100644 index 000000000000..dd88b82331f5 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ExpirationPolicy.php @@ -0,0 +1,98 @@ +google.pubsub.v1.ExpirationPolicy + */ +class ExpirationPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Specifies the "time-to-live" duration for an associated resource. + * The resource expires if it is not active for a period of `ttl`. The + * definition of "activity" depends on the type of the associated resource. + * The minimum and maximum allowed values for `ttl` depend on the type of the + * associated resource, as well. If `ttl` is not set, the associated resource + * never expires. + * + * Generated from protobuf field .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ttl = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $ttl + * Optional. Specifies the "time-to-live" duration for an associated resource. + * The resource expires if it is not active for a period of `ttl`. The + * definition of "activity" depends on the type of the associated resource. + * The minimum and maximum allowed values for `ttl` depend on the type of the + * associated resource, as well. If `ttl` is not set, the associated resource + * never expires. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Specifies the "time-to-live" duration for an associated resource. + * The resource expires if it is not active for a period of `ttl`. The + * definition of "activity" depends on the type of the associated resource. + * The minimum and maximum allowed values for `ttl` depend on the type of the + * associated resource, as well. If `ttl` is not set, the associated resource + * never expires. + * + * Generated from protobuf field .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getTtl() + { + return $this->ttl; + } + + public function hasTtl() + { + return isset($this->ttl); + } + + public function clearTtl() + { + unset($this->ttl); + } + + /** + * Optional. Specifies the "time-to-live" duration for an associated resource. + * The resource expires if it is not active for a period of `ttl`. The + * definition of "activity" depends on the type of the associated resource. + * The minimum and maximum allowed values for `ttl` depend on the type of the + * associated resource, as well. If `ttl` is not set, the associated resource + * never expires. + * + * Generated from protobuf field .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTtl($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->ttl = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSchemaRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSchemaRequest.php new file mode 100644 index 000000000000..afbe7ce6056b --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSchemaRequest.php @@ -0,0 +1,124 @@ +google.pubsub.v1.GetSchemaRequest + */ +class GetSchemaRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the schema to get. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The set of fields to return in the response. If not set, returns a Schema + * with all fields filled out. Set to `BASIC` to omit the `definition`. + * + * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; + */ + protected $view = 0; + + /** + * @param string $name Required. The name of the schema to get. + * Format is `projects/{project}/schemas/{schema}`. Please see + * {@see SchemaServiceClient::schemaName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\GetSchemaRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the schema to get. + * Format is `projects/{project}/schemas/{schema}`. + * @type int $view + * The set of fields to return in the response. If not set, returns a Schema + * with all fields filled out. Set to `BASIC` to omit the `definition`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the schema to get. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the schema to get. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The set of fields to return in the response. If not set, returns a Schema + * with all fields filled out. Set to `BASIC` to omit the `definition`. + * + * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * The set of fields to return in the response. If not set, returns a Schema + * with all fields filled out. Set to `BASIC` to omit the `definition`. + * + * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\SchemaView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSnapshotRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSnapshotRequest.php new file mode 100644 index 000000000000..55f4ab4e63aa --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSnapshotRequest.php @@ -0,0 +1,86 @@ +google.pubsub.v1.GetSnapshotRequest + */ +class GetSnapshotRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the snapshot to get. + * Format is `projects/{project}/snapshots/{snap}`. + * + * Generated from protobuf field string snapshot = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $snapshot = ''; + + /** + * @param string $snapshot Required. The name of the snapshot to get. + * Format is `projects/{project}/snapshots/{snap}`. Please see + * {@see SubscriberClient::snapshotName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\GetSnapshotRequest + * + * @experimental + */ + public static function build(string $snapshot): self + { + return (new self()) + ->setSnapshot($snapshot); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $snapshot + * Required. The name of the snapshot to get. + * Format is `projects/{project}/snapshots/{snap}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the snapshot to get. + * Format is `projects/{project}/snapshots/{snap}`. + * + * Generated from protobuf field string snapshot = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSnapshot() + { + return $this->snapshot; + } + + /** + * Required. The name of the snapshot to get. + * Format is `projects/{project}/snapshots/{snap}`. + * + * Generated from protobuf field string snapshot = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSnapshot($var) + { + GPBUtil::checkString($var, True); + $this->snapshot = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSubscriptionRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSubscriptionRequest.php new file mode 100644 index 000000000000..e9a42ecdf588 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSubscriptionRequest.php @@ -0,0 +1,86 @@ +google.pubsub.v1.GetSubscriptionRequest + */ +class GetSubscriptionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the subscription to get. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $subscription = ''; + + /** + * @param string $subscription Required. The name of the subscription to get. + * Format is `projects/{project}/subscriptions/{sub}`. Please see + * {@see SubscriberClient::subscriptionName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\GetSubscriptionRequest + * + * @experimental + */ + public static function build(string $subscription): self + { + return (new self()) + ->setSubscription($subscription); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subscription + * Required. The name of the subscription to get. + * Format is `projects/{project}/subscriptions/{sub}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the subscription to get. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSubscription() + { + return $this->subscription; + } + + /** + * Required. The name of the subscription to get. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSubscription($var) + { + GPBUtil::checkString($var, True); + $this->subscription = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetTopicRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetTopicRequest.php new file mode 100644 index 000000000000..0686a920c4eb --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetTopicRequest.php @@ -0,0 +1,86 @@ +google.pubsub.v1.GetTopicRequest + */ +class GetTopicRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the topic to get. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $topic = ''; + + /** + * @param string $topic Required. The name of the topic to get. + * Format is `projects/{project}/topics/{topic}`. Please see + * {@see PublisherClient::topicName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\GetTopicRequest + * + * @experimental + */ + public static function build(string $topic): self + { + return (new self()) + ->setTopic($topic); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $topic + * Required. The name of the topic to get. + * Format is `projects/{project}/topics/{topic}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the topic to get. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getTopic() + { + return $this->topic; + } + + /** + * Required. The name of the topic to get. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTopic($var) + { + GPBUtil::checkString($var, True); + $this->topic = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings.php new file mode 100644 index 000000000000..c8f3bd1a0e80 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings.php @@ -0,0 +1,75 @@ +google.pubsub.v1.IngestionDataSourceSettings + */ +class IngestionDataSourceSettings extends \Google\Protobuf\Internal\Message +{ + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\PubSub\V1\IngestionDataSourceSettings\AwsKinesis $aws_kinesis + * Optional. Amazon Kinesis Data Streams. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Amazon Kinesis Data Streams. + * + * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\IngestionDataSourceSettings\AwsKinesis|null + */ + public function getAwsKinesis() + { + return $this->readOneof(1); + } + + public function hasAwsKinesis() + { + return $this->hasOneof(1); + } + + /** + * Optional. Amazon Kinesis Data Streams. + * + * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\IngestionDataSourceSettings\AwsKinesis $var + * @return $this + */ + public function setAwsKinesis($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\IngestionDataSourceSettings\AwsKinesis::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis.php new file mode 100644 index 000000000000..ce30e3b16192 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis.php @@ -0,0 +1,234 @@ +google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis + */ +class AwsKinesis extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. An output-only field that indicates the state of the Kinesis + * ingestion source. + * + * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Required. The Kinesis stream ARN to ingest data from. + * + * Generated from protobuf field string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $stream_arn = ''; + /** + * Required. The Kinesis consumer ARN to used for ingestion in Enhanced + * Fan-Out mode. The consumer must be already created and ready to be used. + * + * Generated from protobuf field string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $consumer_arn = ''; + /** + * Required. AWS role ARN to be used for Federated Identity authentication + * with Kinesis. Check the Pub/Sub docs for how to set up this role and the + * required permissions that need to be attached to it. + * + * Generated from protobuf field string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $aws_role_arn = ''; + /** + * Required. The GCP service account to be used for Federated Identity + * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for + * the provided role). The `aws_role_arn` must be set up with + * `accounts.google.com:sub` equals to this service account number. + * + * Generated from protobuf field string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $gcp_service_account = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * Output only. An output-only field that indicates the state of the Kinesis + * ingestion source. + * @type string $stream_arn + * Required. The Kinesis stream ARN to ingest data from. + * @type string $consumer_arn + * Required. The Kinesis consumer ARN to used for ingestion in Enhanced + * Fan-Out mode. The consumer must be already created and ready to be used. + * @type string $aws_role_arn + * Required. AWS role ARN to be used for Federated Identity authentication + * with Kinesis. Check the Pub/Sub docs for how to set up this role and the + * required permissions that need to be attached to it. + * @type string $gcp_service_account + * Required. The GCP service account to be used for Federated Identity + * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for + * the provided role). The `aws_role_arn` must be set up with + * `accounts.google.com:sub` equals to this service account number. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Output only. An output-only field that indicates the state of the Kinesis + * ingestion source. + * + * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. An output-only field that indicates the state of the Kinesis + * ingestion source. + * + * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\IngestionDataSourceSettings\AwsKinesis\State::class); + $this->state = $var; + + return $this; + } + + /** + * Required. The Kinesis stream ARN to ingest data from. + * + * Generated from protobuf field string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getStreamArn() + { + return $this->stream_arn; + } + + /** + * Required. The Kinesis stream ARN to ingest data from. + * + * Generated from protobuf field string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setStreamArn($var) + { + GPBUtil::checkString($var, True); + $this->stream_arn = $var; + + return $this; + } + + /** + * Required. The Kinesis consumer ARN to used for ingestion in Enhanced + * Fan-Out mode. The consumer must be already created and ready to be used. + * + * Generated from protobuf field string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getConsumerArn() + { + return $this->consumer_arn; + } + + /** + * Required. The Kinesis consumer ARN to used for ingestion in Enhanced + * Fan-Out mode. The consumer must be already created and ready to be used. + * + * Generated from protobuf field string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setConsumerArn($var) + { + GPBUtil::checkString($var, True); + $this->consumer_arn = $var; + + return $this; + } + + /** + * Required. AWS role ARN to be used for Federated Identity authentication + * with Kinesis. Check the Pub/Sub docs for how to set up this role and the + * required permissions that need to be attached to it. + * + * Generated from protobuf field string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAwsRoleArn() + { + return $this->aws_role_arn; + } + + /** + * Required. AWS role ARN to be used for Federated Identity authentication + * with Kinesis. Check the Pub/Sub docs for how to set up this role and the + * required permissions that need to be attached to it. + * + * Generated from protobuf field string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAwsRoleArn($var) + { + GPBUtil::checkString($var, True); + $this->aws_role_arn = $var; + + return $this; + } + + /** + * Required. The GCP service account to be used for Federated Identity + * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for + * the provided role). The `aws_role_arn` must be set up with + * `accounts.google.com:sub` equals to this service account number. + * + * Generated from protobuf field string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getGcpServiceAccount() + { + return $this->gcp_service_account; + } + + /** + * Required. The GCP service account to be used for Federated Identity + * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for + * the provided role). The `aws_role_arn` must be set up with + * `accounts.google.com:sub` equals to this service account number. + * + * Generated from protobuf field string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setGcpServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->gcp_service_account = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AwsKinesis::class, \Google\Cloud\PubSub\V1\IngestionDataSourceSettings_AwsKinesis::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis/State.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis/State.php new file mode 100644 index 000000000000..b53ce8c6788f --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis/State.php @@ -0,0 +1,95 @@ +google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State + */ +class State +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Ingestion is active. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Permission denied encountered while consuming data from Kinesis. + * This can happen if: + * - The provided `aws_role_arn` does not exist or does not have the + * appropriate permissions attached. + * - The provided `aws_role_arn` is not set up properly for Identity + * Federation using `gcp_service_account`. + * - The Pub/Sub SA is not granted the + * `iam.serviceAccounts.getOpenIdToken` permission on + * `gcp_service_account`. + * + * Generated from protobuf enum KINESIS_PERMISSION_DENIED = 2; + */ + const KINESIS_PERMISSION_DENIED = 2; + /** + * Permission denied encountered while publishing to the topic. This can + * happen if the Pub/Sub SA has not been granted the [appropriate publish + * permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher) + * + * Generated from protobuf enum PUBLISH_PERMISSION_DENIED = 3; + */ + const PUBLISH_PERMISSION_DENIED = 3; + /** + * The Kinesis stream does not exist. + * + * Generated from protobuf enum STREAM_NOT_FOUND = 4; + */ + const STREAM_NOT_FOUND = 4; + /** + * The Kinesis consumer does not exist. + * + * Generated from protobuf enum CONSUMER_NOT_FOUND = 5; + */ + const CONSUMER_NOT_FOUND = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::KINESIS_PERMISSION_DENIED => 'KINESIS_PERMISSION_DENIED', + self::PUBLISH_PERMISSION_DENIED => 'PUBLISH_PERMISSION_DENIED', + self::STREAM_NOT_FOUND => 'STREAM_NOT_FOUND', + self::CONSUMER_NOT_FOUND => 'CONSUMER_NOT_FOUND', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\PubSub\V1\IngestionDataSourceSettings_AwsKinesis_State::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsRequest.php new file mode 100644 index 000000000000..b9f24a77534d --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsRequest.php @@ -0,0 +1,195 @@ +google.pubsub.v1.ListSchemaRevisionsRequest + */ +class ListSchemaRevisionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the schema to list revisions for. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The set of Schema fields to return in the response. If not set, returns + * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to + * retrieve all fields. + * + * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; + */ + protected $view = 0; + /** + * The maximum number of revisions to return per page. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * The page token, received from a previous ListSchemaRevisions call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $name Required. The name of the schema to list revisions for. Please see + * {@see SchemaServiceClient::schemaName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\ListSchemaRevisionsRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the schema to list revisions for. + * @type int $view + * The set of Schema fields to return in the response. If not set, returns + * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to + * retrieve all fields. + * @type int $page_size + * The maximum number of revisions to return per page. + * @type string $page_token + * The page token, received from a previous ListSchemaRevisions call. + * Provide this to retrieve the subsequent page. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the schema to list revisions for. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the schema to list revisions for. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The set of Schema fields to return in the response. If not set, returns + * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to + * retrieve all fields. + * + * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * The set of Schema fields to return in the response. If not set, returns + * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to + * retrieve all fields. + * + * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\SchemaView::class); + $this->view = $var; + + return $this; + } + + /** + * The maximum number of revisions to return per page. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of revisions to return per page. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The page token, received from a previous ListSchemaRevisions call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The page token, received from a previous ListSchemaRevisions call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsResponse.php new file mode 100644 index 000000000000..634dc721e15d --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsResponse.php @@ -0,0 +1,105 @@ +google.pubsub.v1.ListSchemaRevisionsResponse + */ +class ListSchemaRevisionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The revisions of the schema. + * + * Generated from protobuf field repeated .google.pubsub.v1.Schema schemas = 1; + */ + private $schemas; + /** + * A token that can be sent as `page_token` to retrieve the next page. + * If this field is empty, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\PubSub\V1\Schema>|\Google\Protobuf\Internal\RepeatedField $schemas + * The revisions of the schema. + * @type string $next_page_token + * A token that can be sent as `page_token` to retrieve the next page. + * If this field is empty, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + + /** + * The revisions of the schema. + * + * Generated from protobuf field repeated .google.pubsub.v1.Schema schemas = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSchemas() + { + return $this->schemas; + } + + /** + * The revisions of the schema. + * + * Generated from protobuf field repeated .google.pubsub.v1.Schema schemas = 1; + * @param array<\Google\Cloud\PubSub\V1\Schema>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSchemas($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\Schema::class); + $this->schemas = $arr; + + return $this; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. + * If this field is empty, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be sent as `page_token` to retrieve the next page. + * If this field is empty, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasRequest.php new file mode 100644 index 000000000000..32b97def03fc --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasRequest.php @@ -0,0 +1,204 @@ +google.pubsub.v1.ListSchemasRequest + */ +class ListSchemasRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project in which to list schemas. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The set of Schema fields to return in the response. If not set, returns + * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to + * retrieve all fields. + * + * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; + */ + protected $view = 0; + /** + * Maximum number of schemas to return. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * The value returned by the last `ListSchemasResponse`; indicates that + * this is a continuation of a prior `ListSchemas` call, and that the + * system should return the next page of data. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The name of the project in which to list schemas. + * Format is `projects/{project-id}`. Please see + * {@see SchemaServiceClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\ListSchemasRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the project in which to list schemas. + * Format is `projects/{project-id}`. + * @type int $view + * The set of Schema fields to return in the response. If not set, returns + * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to + * retrieve all fields. + * @type int $page_size + * Maximum number of schemas to return. + * @type string $page_token + * The value returned by the last `ListSchemasResponse`; indicates that + * this is a continuation of a prior `ListSchemas` call, and that the + * system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project in which to list schemas. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the project in which to list schemas. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The set of Schema fields to return in the response. If not set, returns + * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to + * retrieve all fields. + * + * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * The set of Schema fields to return in the response. If not set, returns + * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to + * retrieve all fields. + * + * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\SchemaView::class); + $this->view = $var; + + return $this; + } + + /** + * Maximum number of schemas to return. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of schemas to return. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The value returned by the last `ListSchemasResponse`; indicates that + * this is a continuation of a prior `ListSchemas` call, and that the + * system should return the next page of data. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The value returned by the last `ListSchemasResponse`; indicates that + * this is a continuation of a prior `ListSchemas` call, and that the + * system should return the next page of data. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasResponse.php new file mode 100644 index 000000000000..c61109d326dc --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasResponse.php @@ -0,0 +1,105 @@ +google.pubsub.v1.ListSchemasResponse + */ +class ListSchemasResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The resulting schemas. + * + * Generated from protobuf field repeated .google.pubsub.v1.Schema schemas = 1; + */ + private $schemas; + /** + * If not empty, indicates that there may be more schemas that match the + * request; this value should be passed in a new `ListSchemasRequest`. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\PubSub\V1\Schema>|\Google\Protobuf\Internal\RepeatedField $schemas + * The resulting schemas. + * @type string $next_page_token + * If not empty, indicates that there may be more schemas that match the + * request; this value should be passed in a new `ListSchemasRequest`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + + /** + * The resulting schemas. + * + * Generated from protobuf field repeated .google.pubsub.v1.Schema schemas = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSchemas() + { + return $this->schemas; + } + + /** + * The resulting schemas. + * + * Generated from protobuf field repeated .google.pubsub.v1.Schema schemas = 1; + * @param array<\Google\Cloud\PubSub\V1\Schema>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSchemas($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\Schema::class); + $this->schemas = $arr; + + return $this; + } + + /** + * If not empty, indicates that there may be more schemas that match the + * request; this value should be passed in a new `ListSchemasRequest`. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If not empty, indicates that there may be more schemas that match the + * request; this value should be passed in a new `ListSchemasRequest`. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsRequest.php new file mode 100644 index 000000000000..b0bbf7bdb442 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsRequest.php @@ -0,0 +1,162 @@ +google.pubsub.v1.ListSnapshotsRequest + */ +class ListSnapshotsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project in which to list snapshots. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $project = ''; + /** + * Optional. Maximum number of snapshots to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. The value returned by the last `ListSnapshotsResponse`; indicates + * that this is a continuation of a prior `ListSnapshots` call, and that the + * system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $project Required. The name of the project in which to list snapshots. + * Format is `projects/{project-id}`. Please see + * {@see SubscriberClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\ListSnapshotsRequest + * + * @experimental + */ + public static function build(string $project): self + { + return (new self()) + ->setProject($project); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project + * Required. The name of the project in which to list snapshots. + * Format is `projects/{project-id}`. + * @type int $page_size + * Optional. Maximum number of snapshots to return. + * @type string $page_token + * Optional. The value returned by the last `ListSnapshotsResponse`; indicates + * that this is a continuation of a prior `ListSnapshots` call, and that the + * system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project in which to list snapshots. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getProject() + { + return $this->project; + } + + /** + * Required. The name of the project in which to list snapshots. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProject($var) + { + GPBUtil::checkString($var, True); + $this->project = $var; + + return $this; + } + + /** + * Optional. Maximum number of snapshots to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Maximum number of snapshots to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The value returned by the last `ListSnapshotsResponse`; indicates + * that this is a continuation of a prior `ListSnapshots` call, and that the + * system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The value returned by the last `ListSnapshotsResponse`; indicates + * that this is a continuation of a prior `ListSnapshots` call, and that the + * system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsResponse.php new file mode 100644 index 000000000000..caf5bbb50e34 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsResponse.php @@ -0,0 +1,109 @@ +google.pubsub.v1.ListSnapshotsResponse + */ +class ListSnapshotsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The resulting snapshots. + * + * Generated from protobuf field repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $snapshots; + /** + * Optional. If not empty, indicates that there may be more snapshot that + * match the request; this value should be passed in a new + * `ListSnapshotsRequest`. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\PubSub\V1\Snapshot>|\Google\Protobuf\Internal\RepeatedField $snapshots + * Optional. The resulting snapshots. + * @type string $next_page_token + * Optional. If not empty, indicates that there may be more snapshot that + * match the request; this value should be passed in a new + * `ListSnapshotsRequest`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The resulting snapshots. + * + * Generated from protobuf field repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSnapshots() + { + return $this->snapshots; + } + + /** + * Optional. The resulting snapshots. + * + * Generated from protobuf field repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\PubSub\V1\Snapshot>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSnapshots($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\Snapshot::class); + $this->snapshots = $arr; + + return $this; + } + + /** + * Optional. If not empty, indicates that there may be more snapshot that + * match the request; this value should be passed in a new + * `ListSnapshotsRequest`. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Optional. If not empty, indicates that there may be more snapshot that + * match the request; this value should be passed in a new + * `ListSnapshotsRequest`. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsRequest.php new file mode 100644 index 000000000000..d1cce8a45b0e --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsRequest.php @@ -0,0 +1,162 @@ +google.pubsub.v1.ListSubscriptionsRequest + */ +class ListSubscriptionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project in which to list subscriptions. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $project = ''; + /** + * Optional. Maximum number of subscriptions to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. The value returned by the last `ListSubscriptionsResponse`; + * indicates that this is a continuation of a prior `ListSubscriptions` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $project Required. The name of the project in which to list subscriptions. + * Format is `projects/{project-id}`. Please see + * {@see SubscriberClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\ListSubscriptionsRequest + * + * @experimental + */ + public static function build(string $project): self + { + return (new self()) + ->setProject($project); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project + * Required. The name of the project in which to list subscriptions. + * Format is `projects/{project-id}`. + * @type int $page_size + * Optional. Maximum number of subscriptions to return. + * @type string $page_token + * Optional. The value returned by the last `ListSubscriptionsResponse`; + * indicates that this is a continuation of a prior `ListSubscriptions` call, + * and that the system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project in which to list subscriptions. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getProject() + { + return $this->project; + } + + /** + * Required. The name of the project in which to list subscriptions. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProject($var) + { + GPBUtil::checkString($var, True); + $this->project = $var; + + return $this; + } + + /** + * Optional. Maximum number of subscriptions to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Maximum number of subscriptions to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The value returned by the last `ListSubscriptionsResponse`; + * indicates that this is a continuation of a prior `ListSubscriptions` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The value returned by the last `ListSubscriptionsResponse`; + * indicates that this is a continuation of a prior `ListSubscriptions` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsResponse.php new file mode 100644 index 000000000000..e875730c48cc --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsResponse.php @@ -0,0 +1,109 @@ +google.pubsub.v1.ListSubscriptionsResponse + */ +class ListSubscriptionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The subscriptions that match the request. + * + * Generated from protobuf field repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $subscriptions; + /** + * Optional. If not empty, indicates that there may be more subscriptions that + * match the request; this value should be passed in a new + * `ListSubscriptionsRequest` to get more subscriptions. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\PubSub\V1\Subscription>|\Google\Protobuf\Internal\RepeatedField $subscriptions + * Optional. The subscriptions that match the request. + * @type string $next_page_token + * Optional. If not empty, indicates that there may be more subscriptions that + * match the request; this value should be passed in a new + * `ListSubscriptionsRequest` to get more subscriptions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The subscriptions that match the request. + * + * Generated from protobuf field repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSubscriptions() + { + return $this->subscriptions; + } + + /** + * Optional. The subscriptions that match the request. + * + * Generated from protobuf field repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\PubSub\V1\Subscription>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSubscriptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\Subscription::class); + $this->subscriptions = $arr; + + return $this; + } + + /** + * Optional. If not empty, indicates that there may be more subscriptions that + * match the request; this value should be passed in a new + * `ListSubscriptionsRequest` to get more subscriptions. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Optional. If not empty, indicates that there may be more subscriptions that + * match the request; this value should be passed in a new + * `ListSubscriptionsRequest` to get more subscriptions. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsRequest.php new file mode 100644 index 000000000000..be1957c835c0 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsRequest.php @@ -0,0 +1,162 @@ +google.pubsub.v1.ListTopicSnapshotsRequest + */ +class ListTopicSnapshotsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the topic that snapshots are attached to. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $topic = ''; + /** + * Optional. Maximum number of snapshot names to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. The value returned by the last `ListTopicSnapshotsResponse`; + * indicates that this is a continuation of a prior `ListTopicSnapshots` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $topic Required. The name of the topic that snapshots are attached to. + * Format is `projects/{project}/topics/{topic}`. Please see + * {@see PublisherClient::topicName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\ListTopicSnapshotsRequest + * + * @experimental + */ + public static function build(string $topic): self + { + return (new self()) + ->setTopic($topic); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $topic + * Required. The name of the topic that snapshots are attached to. + * Format is `projects/{project}/topics/{topic}`. + * @type int $page_size + * Optional. Maximum number of snapshot names to return. + * @type string $page_token + * Optional. The value returned by the last `ListTopicSnapshotsResponse`; + * indicates that this is a continuation of a prior `ListTopicSnapshots` call, + * and that the system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the topic that snapshots are attached to. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getTopic() + { + return $this->topic; + } + + /** + * Required. The name of the topic that snapshots are attached to. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTopic($var) + { + GPBUtil::checkString($var, True); + $this->topic = $var; + + return $this; + } + + /** + * Optional. Maximum number of snapshot names to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Maximum number of snapshot names to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The value returned by the last `ListTopicSnapshotsResponse`; + * indicates that this is a continuation of a prior `ListTopicSnapshots` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The value returned by the last `ListTopicSnapshotsResponse`; + * indicates that this is a continuation of a prior `ListTopicSnapshots` call, + * and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsResponse.php new file mode 100644 index 000000000000..cb08491e5665 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsResponse.php @@ -0,0 +1,109 @@ +google.pubsub.v1.ListTopicSnapshotsResponse + */ +class ListTopicSnapshotsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The names of the snapshots that match the request. + * + * Generated from protobuf field repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $snapshots; + /** + * Optional. If not empty, indicates that there may be more snapshots that + * match the request; this value should be passed in a new + * `ListTopicSnapshotsRequest` to get more snapshots. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $snapshots + * Optional. The names of the snapshots that match the request. + * @type string $next_page_token + * Optional. If not empty, indicates that there may be more snapshots that + * match the request; this value should be passed in a new + * `ListTopicSnapshotsRequest` to get more snapshots. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The names of the snapshots that match the request. + * + * Generated from protobuf field repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSnapshots() + { + return $this->snapshots; + } + + /** + * Optional. The names of the snapshots that match the request. + * + * Generated from protobuf field repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSnapshots($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->snapshots = $arr; + + return $this; + } + + /** + * Optional. If not empty, indicates that there may be more snapshots that + * match the request; this value should be passed in a new + * `ListTopicSnapshotsRequest` to get more snapshots. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Optional. If not empty, indicates that there may be more snapshots that + * match the request; this value should be passed in a new + * `ListTopicSnapshotsRequest` to get more snapshots. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsRequest.php new file mode 100644 index 000000000000..2a3775252ebc --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsRequest.php @@ -0,0 +1,162 @@ +google.pubsub.v1.ListTopicSubscriptionsRequest + */ +class ListTopicSubscriptionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the topic that subscriptions are attached to. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $topic = ''; + /** + * Optional. Maximum number of subscription names to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. The value returned by the last `ListTopicSubscriptionsResponse`; + * indicates that this is a continuation of a prior `ListTopicSubscriptions` + * call, and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $topic Required. The name of the topic that subscriptions are attached to. + * Format is `projects/{project}/topics/{topic}`. Please see + * {@see PublisherClient::topicName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\ListTopicSubscriptionsRequest + * + * @experimental + */ + public static function build(string $topic): self + { + return (new self()) + ->setTopic($topic); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $topic + * Required. The name of the topic that subscriptions are attached to. + * Format is `projects/{project}/topics/{topic}`. + * @type int $page_size + * Optional. Maximum number of subscription names to return. + * @type string $page_token + * Optional. The value returned by the last `ListTopicSubscriptionsResponse`; + * indicates that this is a continuation of a prior `ListTopicSubscriptions` + * call, and that the system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the topic that subscriptions are attached to. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getTopic() + { + return $this->topic; + } + + /** + * Required. The name of the topic that subscriptions are attached to. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTopic($var) + { + GPBUtil::checkString($var, True); + $this->topic = $var; + + return $this; + } + + /** + * Optional. Maximum number of subscription names to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Maximum number of subscription names to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The value returned by the last `ListTopicSubscriptionsResponse`; + * indicates that this is a continuation of a prior `ListTopicSubscriptions` + * call, and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The value returned by the last `ListTopicSubscriptionsResponse`; + * indicates that this is a continuation of a prior `ListTopicSubscriptions` + * call, and that the system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsResponse.php new file mode 100644 index 000000000000..2b7f1c2324e4 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsResponse.php @@ -0,0 +1,113 @@ +google.pubsub.v1.ListTopicSubscriptionsResponse + */ +class ListTopicSubscriptionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The names of subscriptions attached to the topic specified in the + * request. + * + * Generated from protobuf field repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $subscriptions; + /** + * Optional. If not empty, indicates that there may be more subscriptions that + * match the request; this value should be passed in a new + * `ListTopicSubscriptionsRequest` to get more subscriptions. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $subscriptions + * Optional. The names of subscriptions attached to the topic specified in the + * request. + * @type string $next_page_token + * Optional. If not empty, indicates that there may be more subscriptions that + * match the request; this value should be passed in a new + * `ListTopicSubscriptionsRequest` to get more subscriptions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The names of subscriptions attached to the topic specified in the + * request. + * + * Generated from protobuf field repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSubscriptions() + { + return $this->subscriptions; + } + + /** + * Optional. The names of subscriptions attached to the topic specified in the + * request. + * + * Generated from protobuf field repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSubscriptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->subscriptions = $arr; + + return $this; + } + + /** + * Optional. If not empty, indicates that there may be more subscriptions that + * match the request; this value should be passed in a new + * `ListTopicSubscriptionsRequest` to get more subscriptions. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Optional. If not empty, indicates that there may be more subscriptions that + * match the request; this value should be passed in a new + * `ListTopicSubscriptionsRequest` to get more subscriptions. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsRequest.php new file mode 100644 index 000000000000..fe2336bce34b --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsRequest.php @@ -0,0 +1,162 @@ +google.pubsub.v1.ListTopicsRequest + */ +class ListTopicsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project in which to list topics. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $project = ''; + /** + * Optional. Maximum number of topics to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. The value returned by the last `ListTopicsResponse`; indicates + * that this is a continuation of a prior `ListTopics` call, and that the + * system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $project Required. The name of the project in which to list topics. + * Format is `projects/{project-id}`. Please see + * {@see PublisherClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\PubSub\V1\ListTopicsRequest + * + * @experimental + */ + public static function build(string $project): self + { + return (new self()) + ->setProject($project); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project + * Required. The name of the project in which to list topics. + * Format is `projects/{project-id}`. + * @type int $page_size + * Optional. Maximum number of topics to return. + * @type string $page_token + * Optional. The value returned by the last `ListTopicsResponse`; indicates + * that this is a continuation of a prior `ListTopics` call, and that the + * system should return the next page of data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project in which to list topics. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getProject() + { + return $this->project; + } + + /** + * Required. The name of the project in which to list topics. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProject($var) + { + GPBUtil::checkString($var, True); + $this->project = $var; + + return $this; + } + + /** + * Optional. Maximum number of topics to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Maximum number of topics to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The value returned by the last `ListTopicsResponse`; indicates + * that this is a continuation of a prior `ListTopics` call, and that the + * system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The value returned by the last `ListTopicsResponse`; indicates + * that this is a continuation of a prior `ListTopics` call, and that the + * system should return the next page of data. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsResponse.php new file mode 100644 index 000000000000..79a07799e342 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsResponse.php @@ -0,0 +1,105 @@ +google.pubsub.v1.ListTopicsResponse + */ +class ListTopicsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The resulting topics. + * + * Generated from protobuf field repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $topics; + /** + * Optional. If not empty, indicates that there may be more topics that match + * the request; this value should be passed in a new `ListTopicsRequest`. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\PubSub\V1\Topic>|\Google\Protobuf\Internal\RepeatedField $topics + * Optional. The resulting topics. + * @type string $next_page_token + * Optional. If not empty, indicates that there may be more topics that match + * the request; this value should be passed in a new `ListTopicsRequest`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The resulting topics. + * + * Generated from protobuf field repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTopics() + { + return $this->topics; + } + + /** + * Optional. The resulting topics. + * + * Generated from protobuf field repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\PubSub\V1\Topic>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTopics($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\Topic::class); + $this->topics = $arr; + + return $this; + } + + /** + * Optional. If not empty, indicates that there may be more topics that match + * the request; this value should be passed in a new `ListTopicsRequest`. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Optional. If not empty, indicates that there may be more topics that match + * the request; this value should be passed in a new `ListTopicsRequest`. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/MessageStoragePolicy.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/MessageStoragePolicy.php new file mode 100644 index 000000000000..b31b0ad03911 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/MessageStoragePolicy.php @@ -0,0 +1,137 @@ +google.pubsub.v1.MessageStoragePolicy + */ +class MessageStoragePolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. A list of IDs of Google Cloud regions where messages that are + * published to the topic may be persisted in storage. Messages published by + * publishers running in non-allowed Google Cloud regions (or running outside + * of Google Cloud altogether) are routed for storage in one of the allowed + * regions. An empty list means that no regions are allowed, and is not a + * valid configuration. + * + * Generated from protobuf field repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $allowed_persistence_regions; + /** + * Optional. If true, `allowed_persistence_regions` is also used to enforce + * in-transit guarantees for messages. That is, Pub/Sub will fail + * Publish operations on this topic and subscribe operations + * on any subscription attached to this topic in any region that is + * not in `allowed_persistence_regions`. + * + * Generated from protobuf field bool enforce_in_transit = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $enforce_in_transit = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $allowed_persistence_regions + * Optional. A list of IDs of Google Cloud regions where messages that are + * published to the topic may be persisted in storage. Messages published by + * publishers running in non-allowed Google Cloud regions (or running outside + * of Google Cloud altogether) are routed for storage in one of the allowed + * regions. An empty list means that no regions are allowed, and is not a + * valid configuration. + * @type bool $enforce_in_transit + * Optional. If true, `allowed_persistence_regions` is also used to enforce + * in-transit guarantees for messages. That is, Pub/Sub will fail + * Publish operations on this topic and subscribe operations + * on any subscription attached to this topic in any region that is + * not in `allowed_persistence_regions`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. A list of IDs of Google Cloud regions where messages that are + * published to the topic may be persisted in storage. Messages published by + * publishers running in non-allowed Google Cloud regions (or running outside + * of Google Cloud altogether) are routed for storage in one of the allowed + * regions. An empty list means that no regions are allowed, and is not a + * valid configuration. + * + * Generated from protobuf field repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAllowedPersistenceRegions() + { + return $this->allowed_persistence_regions; + } + + /** + * Optional. A list of IDs of Google Cloud regions where messages that are + * published to the topic may be persisted in storage. Messages published by + * publishers running in non-allowed Google Cloud regions (or running outside + * of Google Cloud altogether) are routed for storage in one of the allowed + * regions. An empty list means that no regions are allowed, and is not a + * valid configuration. + * + * Generated from protobuf field repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAllowedPersistenceRegions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->allowed_persistence_regions = $arr; + + return $this; + } + + /** + * Optional. If true, `allowed_persistence_regions` is also used to enforce + * in-transit guarantees for messages. That is, Pub/Sub will fail + * Publish operations on this topic and subscribe operations + * on any subscription attached to this topic in any region that is + * not in `allowed_persistence_regions`. + * + * Generated from protobuf field bool enforce_in_transit = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getEnforceInTransit() + { + return $this->enforce_in_transit; + } + + /** + * Optional. If true, `allowed_persistence_regions` is also used to enforce + * in-transit guarantees for messages. That is, Pub/Sub will fail + * Publish operations on this topic and subscribe operations + * on any subscription attached to this topic in any region that is + * not in `allowed_persistence_regions`. + * + * Generated from protobuf field bool enforce_in_transit = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setEnforceInTransit($var) + { + GPBUtil::checkBool($var); + $this->enforce_in_transit = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyAckDeadlineRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyAckDeadlineRequest.php new file mode 100644 index 000000000000..91c8c3e18e23 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyAckDeadlineRequest.php @@ -0,0 +1,198 @@ +google.pubsub.v1.ModifyAckDeadlineRequest + */ +class ModifyAckDeadlineRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the subscription. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $subscription = ''; + /** + * Required. List of acknowledgment IDs. + * + * Generated from protobuf field repeated string ack_ids = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + private $ack_ids; + /** + * Required. The new ack deadline with respect to the time this request was + * sent to the Pub/Sub system. For example, if the value is 10, the new ack + * deadline will expire 10 seconds after the `ModifyAckDeadline` call was + * made. Specifying zero might immediately make the message available for + * delivery to another subscriber client. This typically results in an + * increase in the rate of message redeliveries (that is, duplicates). + * The minimum deadline you can specify is 0 seconds. + * The maximum deadline you can specify in a single request is 600 seconds + * (10 minutes). + * + * Generated from protobuf field int32 ack_deadline_seconds = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $ack_deadline_seconds = 0; + + /** + * @param string $subscription Required. The name of the subscription. + * Format is `projects/{project}/subscriptions/{sub}`. Please see + * {@see SubscriberClient::subscriptionName()} for help formatting this field. + * @param string[] $ackIds Required. List of acknowledgment IDs. + * @param int $ackDeadlineSeconds Required. The new ack deadline with respect to the time this request was + * sent to the Pub/Sub system. For example, if the value is 10, the new ack + * deadline will expire 10 seconds after the `ModifyAckDeadline` call was + * made. Specifying zero might immediately make the message available for + * delivery to another subscriber client. This typically results in an + * increase in the rate of message redeliveries (that is, duplicates). + * The minimum deadline you can specify is 0 seconds. + * The maximum deadline you can specify in a single request is 600 seconds + * (10 minutes). + * + * @return \Google\Cloud\PubSub\V1\ModifyAckDeadlineRequest + * + * @experimental + */ + public static function build(string $subscription, array $ackIds, int $ackDeadlineSeconds): self + { + return (new self()) + ->setSubscription($subscription) + ->setAckIds($ackIds) + ->setAckDeadlineSeconds($ackDeadlineSeconds); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subscription + * Required. The name of the subscription. + * Format is `projects/{project}/subscriptions/{sub}`. + * @type array|\Google\Protobuf\Internal\RepeatedField $ack_ids + * Required. List of acknowledgment IDs. + * @type int $ack_deadline_seconds + * Required. The new ack deadline with respect to the time this request was + * sent to the Pub/Sub system. For example, if the value is 10, the new ack + * deadline will expire 10 seconds after the `ModifyAckDeadline` call was + * made. Specifying zero might immediately make the message available for + * delivery to another subscriber client. This typically results in an + * increase in the rate of message redeliveries (that is, duplicates). + * The minimum deadline you can specify is 0 seconds. + * The maximum deadline you can specify in a single request is 600 seconds + * (10 minutes). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the subscription. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSubscription() + { + return $this->subscription; + } + + /** + * Required. The name of the subscription. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSubscription($var) + { + GPBUtil::checkString($var, True); + $this->subscription = $var; + + return $this; + } + + /** + * Required. List of acknowledgment IDs. + * + * Generated from protobuf field repeated string ack_ids = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAckIds() + { + return $this->ack_ids; + } + + /** + * Required. List of acknowledgment IDs. + * + * Generated from protobuf field repeated string ack_ids = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAckIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->ack_ids = $arr; + + return $this; + } + + /** + * Required. The new ack deadline with respect to the time this request was + * sent to the Pub/Sub system. For example, if the value is 10, the new ack + * deadline will expire 10 seconds after the `ModifyAckDeadline` call was + * made. Specifying zero might immediately make the message available for + * delivery to another subscriber client. This typically results in an + * increase in the rate of message redeliveries (that is, duplicates). + * The minimum deadline you can specify is 0 seconds. + * The maximum deadline you can specify in a single request is 600 seconds + * (10 minutes). + * + * Generated from protobuf field int32 ack_deadline_seconds = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getAckDeadlineSeconds() + { + return $this->ack_deadline_seconds; + } + + /** + * Required. The new ack deadline with respect to the time this request was + * sent to the Pub/Sub system. For example, if the value is 10, the new ack + * deadline will expire 10 seconds after the `ModifyAckDeadline` call was + * made. Specifying zero might immediately make the message available for + * delivery to another subscriber client. This typically results in an + * increase in the rate of message redeliveries (that is, duplicates). + * The minimum deadline you can specify is 0 seconds. + * The maximum deadline you can specify in a single request is 600 seconds + * (10 minutes). + * + * Generated from protobuf field int32 ack_deadline_seconds = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setAckDeadlineSeconds($var) + { + GPBUtil::checkInt32($var); + $this->ack_deadline_seconds = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyPushConfigRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyPushConfigRequest.php new file mode 100644 index 000000000000..7a2f636dcaf1 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyPushConfigRequest.php @@ -0,0 +1,153 @@ +google.pubsub.v1.ModifyPushConfigRequest + */ +class ModifyPushConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the subscription. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $subscription = ''; + /** + * Required. The push configuration for future deliveries. + * An empty `pushConfig` indicates that the Pub/Sub system should + * stop pushing messages from the given subscription and allow + * messages to be pulled and acknowledged - effectively pausing + * the subscription if `Pull` or `StreamingPull` is not called. + * + * Generated from protobuf field .google.pubsub.v1.PushConfig push_config = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $push_config = null; + + /** + * @param string $subscription Required. The name of the subscription. + * Format is `projects/{project}/subscriptions/{sub}`. Please see + * {@see SubscriberClient::subscriptionName()} for help formatting this field. + * @param \Google\Cloud\PubSub\V1\PushConfig $pushConfig Required. The push configuration for future deliveries. + * + * An empty `pushConfig` indicates that the Pub/Sub system should + * stop pushing messages from the given subscription and allow + * messages to be pulled and acknowledged - effectively pausing + * the subscription if `Pull` or `StreamingPull` is not called. + * + * @return \Google\Cloud\PubSub\V1\ModifyPushConfigRequest + * + * @experimental + */ + public static function build(string $subscription, \Google\Cloud\PubSub\V1\PushConfig $pushConfig): self + { + return (new self()) + ->setSubscription($subscription) + ->setPushConfig($pushConfig); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subscription + * Required. The name of the subscription. + * Format is `projects/{project}/subscriptions/{sub}`. + * @type \Google\Cloud\PubSub\V1\PushConfig $push_config + * Required. The push configuration for future deliveries. + * An empty `pushConfig` indicates that the Pub/Sub system should + * stop pushing messages from the given subscription and allow + * messages to be pulled and acknowledged - effectively pausing + * the subscription if `Pull` or `StreamingPull` is not called. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the subscription. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSubscription() + { + return $this->subscription; + } + + /** + * Required. The name of the subscription. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSubscription($var) + { + GPBUtil::checkString($var, True); + $this->subscription = $var; + + return $this; + } + + /** + * Required. The push configuration for future deliveries. + * An empty `pushConfig` indicates that the Pub/Sub system should + * stop pushing messages from the given subscription and allow + * messages to be pulled and acknowledged - effectively pausing + * the subscription if `Pull` or `StreamingPull` is not called. + * + * Generated from protobuf field .google.pubsub.v1.PushConfig push_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\PubSub\V1\PushConfig|null + */ + public function getPushConfig() + { + return $this->push_config; + } + + public function hasPushConfig() + { + return isset($this->push_config); + } + + public function clearPushConfig() + { + unset($this->push_config); + } + + /** + * Required. The push configuration for future deliveries. + * An empty `pushConfig` indicates that the Pub/Sub system should + * stop pushing messages from the given subscription and allow + * messages to be pulled and acknowledged - effectively pausing + * the subscription if `Pull` or `StreamingPull` is not called. + * + * Generated from protobuf field .google.pubsub.v1.PushConfig push_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\PubSub\V1\PushConfig $var + * @return $this + */ + public function setPushConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PushConfig::class); + $this->push_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishRequest.php new file mode 100644 index 000000000000..c548ceb7fcb5 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishRequest.php @@ -0,0 +1,122 @@ +google.pubsub.v1.PublishRequest + */ +class PublishRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The messages in the request will be published on this topic. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $topic = ''; + /** + * Required. The messages to publish. + * + * Generated from protobuf field repeated .google.pubsub.v1.PubsubMessage messages = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $messages; + + /** + * @param string $topic Required. The messages in the request will be published on this topic. + * Format is `projects/{project}/topics/{topic}`. Please see + * {@see PublisherClient::topicName()} for help formatting this field. + * @param \Google\Cloud\PubSub\V1\PubsubMessage[] $messages Required. The messages to publish. + * + * @return \Google\Cloud\PubSub\V1\PublishRequest + * + * @experimental + */ + public static function build(string $topic, array $messages): self + { + return (new self()) + ->setTopic($topic) + ->setMessages($messages); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $topic + * Required. The messages in the request will be published on this topic. + * Format is `projects/{project}/topics/{topic}`. + * @type array<\Google\Cloud\PubSub\V1\PubsubMessage>|\Google\Protobuf\Internal\RepeatedField $messages + * Required. The messages to publish. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The messages in the request will be published on this topic. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getTopic() + { + return $this->topic; + } + + /** + * Required. The messages in the request will be published on this topic. + * Format is `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTopic($var) + { + GPBUtil::checkString($var, True); + $this->topic = $var; + + return $this; + } + + /** + * Required. The messages to publish. + * + * Generated from protobuf field repeated .google.pubsub.v1.PubsubMessage messages = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMessages() + { + return $this->messages; + } + + /** + * Required. The messages to publish. + * + * Generated from protobuf field repeated .google.pubsub.v1.PubsubMessage messages = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\PubSub\V1\PubsubMessage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMessages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\PubsubMessage::class); + $this->messages = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishResponse.php new file mode 100644 index 000000000000..c36633c7d984 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishResponse.php @@ -0,0 +1,75 @@ +google.pubsub.v1.PublishResponse + */ +class PublishResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The server-assigned ID of each published message, in the same + * order as the messages in the request. IDs are guaranteed to be unique + * within the topic. + * + * Generated from protobuf field repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $message_ids; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $message_ids + * Optional. The server-assigned ID of each published message, in the same + * order as the messages in the request. IDs are guaranteed to be unique + * within the topic. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The server-assigned ID of each published message, in the same + * order as the messages in the request. IDs are guaranteed to be unique + * within the topic. + * + * Generated from protobuf field repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMessageIds() + { + return $this->message_ids; + } + + /** + * Optional. The server-assigned ID of each published message, in the same + * order as the messages in the request. IDs are guaranteed to be unique + * within the topic. + * + * Generated from protobuf field repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMessageIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->message_ids = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PubsubMessage.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PubsubMessage.php new file mode 100644 index 000000000000..4c05dc58da3b --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PubsubMessage.php @@ -0,0 +1,280 @@ +google.pubsub.v1.PubsubMessage + */ +class PubsubMessage extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The message data field. If this field is empty, the message must + * contain at least one attribute. + * + * Generated from protobuf field bytes data = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $data = ''; + /** + * Optional. Attributes for this message. If this field is empty, the message + * must contain non-empty data. This can be used to filter messages on the + * subscription. + * + * Generated from protobuf field map attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $attributes; + /** + * ID of this message, assigned by the server when the message is published. + * Guaranteed to be unique within the topic. This value may be read by a + * subscriber that receives a `PubsubMessage` via a `Pull` call or a push + * delivery. It must not be populated by the publisher in a `Publish` call. + * + * Generated from protobuf field string message_id = 3; + */ + protected $message_id = ''; + /** + * The time at which the message was published, populated by the server when + * it receives the `Publish` call. It must not be populated by the + * publisher in a `Publish` call. + * + * Generated from protobuf field .google.protobuf.Timestamp publish_time = 4; + */ + protected $publish_time = null; + /** + * Optional. If non-empty, identifies related messages for which publish order + * should be respected. If a `Subscription` has `enable_message_ordering` set + * to `true`, messages published with the same non-empty `ordering_key` value + * will be delivered to subscribers in the order in which they are received by + * the Pub/Sub system. All `PubsubMessage`s published in a given + * `PublishRequest` must specify the same `ordering_key` value. For more + * information, see [ordering + * messages](https://cloud.google.com/pubsub/docs/ordering). + * + * Generated from protobuf field string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ordering_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $data + * Optional. The message data field. If this field is empty, the message must + * contain at least one attribute. + * @type array|\Google\Protobuf\Internal\MapField $attributes + * Optional. Attributes for this message. If this field is empty, the message + * must contain non-empty data. This can be used to filter messages on the + * subscription. + * @type string $message_id + * ID of this message, assigned by the server when the message is published. + * Guaranteed to be unique within the topic. This value may be read by a + * subscriber that receives a `PubsubMessage` via a `Pull` call or a push + * delivery. It must not be populated by the publisher in a `Publish` call. + * @type \Google\Protobuf\Timestamp $publish_time + * The time at which the message was published, populated by the server when + * it receives the `Publish` call. It must not be populated by the + * publisher in a `Publish` call. + * @type string $ordering_key + * Optional. If non-empty, identifies related messages for which publish order + * should be respected. If a `Subscription` has `enable_message_ordering` set + * to `true`, messages published with the same non-empty `ordering_key` value + * will be delivered to subscribers in the order in which they are received by + * the Pub/Sub system. All `PubsubMessage`s published in a given + * `PublishRequest` must specify the same `ordering_key` value. For more + * information, see [ordering + * messages](https://cloud.google.com/pubsub/docs/ordering). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The message data field. If this field is empty, the message must + * contain at least one attribute. + * + * Generated from protobuf field bytes data = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getData() + { + return $this->data; + } + + /** + * Optional. The message data field. If this field is empty, the message must + * contain at least one attribute. + * + * Generated from protobuf field bytes data = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setData($var) + { + GPBUtil::checkString($var, False); + $this->data = $var; + + return $this; + } + + /** + * Optional. Attributes for this message. If this field is empty, the message + * must contain non-empty data. This can be used to filter messages on the + * subscription. + * + * Generated from protobuf field map attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Optional. Attributes for this message. If this field is empty, the message + * must contain non-empty data. This can be used to filter messages on the + * subscription. + * + * Generated from protobuf field map attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAttributes($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->attributes = $arr; + + return $this; + } + + /** + * ID of this message, assigned by the server when the message is published. + * Guaranteed to be unique within the topic. This value may be read by a + * subscriber that receives a `PubsubMessage` via a `Pull` call or a push + * delivery. It must not be populated by the publisher in a `Publish` call. + * + * Generated from protobuf field string message_id = 3; + * @return string + */ + public function getMessageId() + { + return $this->message_id; + } + + /** + * ID of this message, assigned by the server when the message is published. + * Guaranteed to be unique within the topic. This value may be read by a + * subscriber that receives a `PubsubMessage` via a `Pull` call or a push + * delivery. It must not be populated by the publisher in a `Publish` call. + * + * Generated from protobuf field string message_id = 3; + * @param string $var + * @return $this + */ + public function setMessageId($var) + { + GPBUtil::checkString($var, True); + $this->message_id = $var; + + return $this; + } + + /** + * The time at which the message was published, populated by the server when + * it receives the `Publish` call. It must not be populated by the + * publisher in a `Publish` call. + * + * Generated from protobuf field .google.protobuf.Timestamp publish_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getPublishTime() + { + return $this->publish_time; + } + + public function hasPublishTime() + { + return isset($this->publish_time); + } + + public function clearPublishTime() + { + unset($this->publish_time); + } + + /** + * The time at which the message was published, populated by the server when + * it receives the `Publish` call. It must not be populated by the + * publisher in a `Publish` call. + * + * Generated from protobuf field .google.protobuf.Timestamp publish_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setPublishTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->publish_time = $var; + + return $this; + } + + /** + * Optional. If non-empty, identifies related messages for which publish order + * should be respected. If a `Subscription` has `enable_message_ordering` set + * to `true`, messages published with the same non-empty `ordering_key` value + * will be delivered to subscribers in the order in which they are received by + * the Pub/Sub system. All `PubsubMessage`s published in a given + * `PublishRequest` must specify the same `ordering_key` value. For more + * information, see [ordering + * messages](https://cloud.google.com/pubsub/docs/ordering). + * + * Generated from protobuf field string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderingKey() + { + return $this->ordering_key; + } + + /** + * Optional. If non-empty, identifies related messages for which publish order + * should be respected. If a `Subscription` has `enable_message_ordering` set + * to `true`, messages published with the same non-empty `ordering_key` value + * will be delivered to subscribers in the order in which they are received by + * the Pub/Sub system. All `PubsubMessage`s published in a given + * `PublishRequest` must specify the same `ordering_key` value. For more + * information, see [ordering + * messages](https://cloud.google.com/pubsub/docs/ordering). + * + * Generated from protobuf field string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderingKey($var) + { + GPBUtil::checkString($var, True); + $this->ordering_key = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullRequest.php new file mode 100644 index 000000000000..5d0f8c33aebb --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullRequest.php @@ -0,0 +1,222 @@ +google.pubsub.v1.PullRequest + */ +class PullRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The subscription from which messages should be pulled. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $subscription = ''; + /** + * Optional. If this field set to true, the system will respond immediately + * even if it there are no messages available to return in the `Pull` + * response. Otherwise, the system may wait (for a bounded amount of time) + * until at least one message is available, rather than returning no messages. + * Warning: setting this field to `true` is discouraged because it adversely + * impacts the performance of `Pull` operations. We recommend that users do + * not set this field. + * + * Generated from protobuf field bool return_immediately = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @deprecated + */ + protected $return_immediately = false; + /** + * Required. The maximum number of messages to return for this request. Must + * be a positive integer. The Pub/Sub system may return fewer than the number + * specified. + * + * Generated from protobuf field int32 max_messages = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $max_messages = 0; + + /** + * @param string $subscription Required. The subscription from which messages should be pulled. + * Format is `projects/{project}/subscriptions/{sub}`. Please see + * {@see SubscriberClient::subscriptionName()} for help formatting this field. + * @param bool $returnImmediately Optional. If this field set to true, the system will respond immediately + * even if it there are no messages available to return in the `Pull` + * response. Otherwise, the system may wait (for a bounded amount of time) + * until at least one message is available, rather than returning no messages. + * Warning: setting this field to `true` is discouraged because it adversely + * impacts the performance of `Pull` operations. We recommend that users do + * not set this field. + * @param int $maxMessages Required. The maximum number of messages to return for this request. Must + * be a positive integer. The Pub/Sub system may return fewer than the number + * specified. + * + * @return \Google\Cloud\PubSub\V1\PullRequest + * + * @experimental + */ + public static function build(string $subscription, bool $returnImmediately, int $maxMessages): self + { + return (new self()) + ->setSubscription($subscription) + ->setReturnImmediately($returnImmediately) + ->setMaxMessages($maxMessages); + } + + /** + * @param string $subscription Required. The subscription from which messages should be pulled. + * Format is `projects/{project}/subscriptions/{sub}`. Please see + * {@see SubscriberClient::subscriptionName()} for help formatting this field. + * @param int $maxMessages Required. The maximum number of messages to return for this request. Must + * be a positive integer. The Pub/Sub system may return fewer than the number + * specified. + * + * @return \Google\Cloud\PubSub\V1\PullRequest + * + * @experimental + */ + public static function buildFromSubscriptionMaxMessages(string $subscription, int $maxMessages): self + { + return (new self()) + ->setSubscription($subscription) + ->setMaxMessages($maxMessages); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subscription + * Required. The subscription from which messages should be pulled. + * Format is `projects/{project}/subscriptions/{sub}`. + * @type bool $return_immediately + * Optional. If this field set to true, the system will respond immediately + * even if it there are no messages available to return in the `Pull` + * response. Otherwise, the system may wait (for a bounded amount of time) + * until at least one message is available, rather than returning no messages. + * Warning: setting this field to `true` is discouraged because it adversely + * impacts the performance of `Pull` operations. We recommend that users do + * not set this field. + * @type int $max_messages + * Required. The maximum number of messages to return for this request. Must + * be a positive integer. The Pub/Sub system may return fewer than the number + * specified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The subscription from which messages should be pulled. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSubscription() + { + return $this->subscription; + } + + /** + * Required. The subscription from which messages should be pulled. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSubscription($var) + { + GPBUtil::checkString($var, True); + $this->subscription = $var; + + return $this; + } + + /** + * Optional. If this field set to true, the system will respond immediately + * even if it there are no messages available to return in the `Pull` + * response. Otherwise, the system may wait (for a bounded amount of time) + * until at least one message is available, rather than returning no messages. + * Warning: setting this field to `true` is discouraged because it adversely + * impacts the performance of `Pull` operations. We recommend that users do + * not set this field. + * + * Generated from protobuf field bool return_immediately = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @return bool + * @deprecated + */ + public function getReturnImmediately() + { + @trigger_error('return_immediately is deprecated.', E_USER_DEPRECATED); + return $this->return_immediately; + } + + /** + * Optional. If this field set to true, the system will respond immediately + * even if it there are no messages available to return in the `Pull` + * response. Otherwise, the system may wait (for a bounded amount of time) + * until at least one message is available, rather than returning no messages. + * Warning: setting this field to `true` is discouraged because it adversely + * impacts the performance of `Pull` operations. We recommend that users do + * not set this field. + * + * Generated from protobuf field bool return_immediately = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + * @deprecated + */ + public function setReturnImmediately($var) + { + @trigger_error('return_immediately is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkBool($var); + $this->return_immediately = $var; + + return $this; + } + + /** + * Required. The maximum number of messages to return for this request. Must + * be a positive integer. The Pub/Sub system may return fewer than the number + * specified. + * + * Generated from protobuf field int32 max_messages = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getMaxMessages() + { + return $this->max_messages; + } + + /** + * Required. The maximum number of messages to return for this request. Must + * be a positive integer. The Pub/Sub system may return fewer than the number + * specified. + * + * Generated from protobuf field int32 max_messages = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setMaxMessages($var) + { + GPBUtil::checkInt32($var); + $this->max_messages = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullResponse.php new file mode 100644 index 000000000000..44c90cd8571c --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullResponse.php @@ -0,0 +1,83 @@ +google.pubsub.v1.PullResponse + */ +class PullResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Received Pub/Sub messages. The list will be empty if there are no + * more messages available in the backlog, or if no messages could be returned + * before the request timeout. For JSON, the response can be entirely + * empty. The Pub/Sub system may return fewer than the `maxMessages` requested + * even if there are more messages available in the backlog. + * + * Generated from protobuf field repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $received_messages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\PubSub\V1\ReceivedMessage>|\Google\Protobuf\Internal\RepeatedField $received_messages + * Optional. Received Pub/Sub messages. The list will be empty if there are no + * more messages available in the backlog, or if no messages could be returned + * before the request timeout. For JSON, the response can be entirely + * empty. The Pub/Sub system may return fewer than the `maxMessages` requested + * even if there are more messages available in the backlog. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Received Pub/Sub messages. The list will be empty if there are no + * more messages available in the backlog, or if no messages could be returned + * before the request timeout. For JSON, the response can be entirely + * empty. The Pub/Sub system may return fewer than the `maxMessages` requested + * even if there are more messages available in the backlog. + * + * Generated from protobuf field repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReceivedMessages() + { + return $this->received_messages; + } + + /** + * Optional. Received Pub/Sub messages. The list will be empty if there are no + * more messages available in the backlog, or if no messages could be returned + * before the request timeout. For JSON, the response can be entirely + * empty. The Pub/Sub system may return fewer than the `maxMessages` requested + * even if there are more messages available in the backlog. + * + * Generated from protobuf field repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\PubSub\V1\ReceivedMessage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReceivedMessages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\ReceivedMessage::class); + $this->received_messages = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig.php new file mode 100644 index 000000000000..c0dd0f9777d7 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig.php @@ -0,0 +1,294 @@ +google.pubsub.v1.PushConfig + */ +class PushConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. A URL locating the endpoint to which messages should be pushed. + * For example, a Webhook endpoint might use `https://example.com/push`. + * + * Generated from protobuf field string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $push_endpoint = ''; + /** + * Optional. Endpoint configuration attributes that can be used to control + * different aspects of the message delivery. + * The only currently supported attribute is `x-goog-version`, which you can + * use to change the format of the pushed message. This attribute + * indicates the version of the data expected by the endpoint. This + * controls the shape of the pushed message (i.e., its fields and metadata). + * If not present during the `CreateSubscription` call, it will default to + * the version of the Pub/Sub API used to make such call. If not present in a + * `ModifyPushConfig` call, its value will not be changed. `GetSubscription` + * calls will always return a valid version, even if the subscription was + * created without this attribute. + * The only supported values for the `x-goog-version` attribute are: + * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. + * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. + * For example: + * `attributes { "x-goog-version": "v1" }` + * + * Generated from protobuf field map attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $attributes; + protected $authentication_method; + protected $wrapper; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $push_endpoint + * Optional. A URL locating the endpoint to which messages should be pushed. + * For example, a Webhook endpoint might use `https://example.com/push`. + * @type array|\Google\Protobuf\Internal\MapField $attributes + * Optional. Endpoint configuration attributes that can be used to control + * different aspects of the message delivery. + * The only currently supported attribute is `x-goog-version`, which you can + * use to change the format of the pushed message. This attribute + * indicates the version of the data expected by the endpoint. This + * controls the shape of the pushed message (i.e., its fields and metadata). + * If not present during the `CreateSubscription` call, it will default to + * the version of the Pub/Sub API used to make such call. If not present in a + * `ModifyPushConfig` call, its value will not be changed. `GetSubscription` + * calls will always return a valid version, even if the subscription was + * created without this attribute. + * The only supported values for the `x-goog-version` attribute are: + * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. + * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. + * For example: + * `attributes { "x-goog-version": "v1" }` + * @type \Google\Cloud\PubSub\V1\PushConfig\OidcToken $oidc_token + * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT + * token as an `Authorization` header in the HTTP request for every pushed + * message. + * @type \Google\Cloud\PubSub\V1\PushConfig\PubsubWrapper $pubsub_wrapper + * Optional. When set, the payload to the push endpoint is in the form of + * the JSON representation of a PubsubMessage + * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage). + * @type \Google\Cloud\PubSub\V1\PushConfig\NoWrapper $no_wrapper + * Optional. When set, the payload to the push endpoint is not wrapped. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. A URL locating the endpoint to which messages should be pushed. + * For example, a Webhook endpoint might use `https://example.com/push`. + * + * Generated from protobuf field string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPushEndpoint() + { + return $this->push_endpoint; + } + + /** + * Optional. A URL locating the endpoint to which messages should be pushed. + * For example, a Webhook endpoint might use `https://example.com/push`. + * + * Generated from protobuf field string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPushEndpoint($var) + { + GPBUtil::checkString($var, True); + $this->push_endpoint = $var; + + return $this; + } + + /** + * Optional. Endpoint configuration attributes that can be used to control + * different aspects of the message delivery. + * The only currently supported attribute is `x-goog-version`, which you can + * use to change the format of the pushed message. This attribute + * indicates the version of the data expected by the endpoint. This + * controls the shape of the pushed message (i.e., its fields and metadata). + * If not present during the `CreateSubscription` call, it will default to + * the version of the Pub/Sub API used to make such call. If not present in a + * `ModifyPushConfig` call, its value will not be changed. `GetSubscription` + * calls will always return a valid version, even if the subscription was + * created without this attribute. + * The only supported values for the `x-goog-version` attribute are: + * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. + * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. + * For example: + * `attributes { "x-goog-version": "v1" }` + * + * Generated from protobuf field map attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Optional. Endpoint configuration attributes that can be used to control + * different aspects of the message delivery. + * The only currently supported attribute is `x-goog-version`, which you can + * use to change the format of the pushed message. This attribute + * indicates the version of the data expected by the endpoint. This + * controls the shape of the pushed message (i.e., its fields and metadata). + * If not present during the `CreateSubscription` call, it will default to + * the version of the Pub/Sub API used to make such call. If not present in a + * `ModifyPushConfig` call, its value will not be changed. `GetSubscription` + * calls will always return a valid version, even if the subscription was + * created without this attribute. + * The only supported values for the `x-goog-version` attribute are: + * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. + * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. + * For example: + * `attributes { "x-goog-version": "v1" }` + * + * Generated from protobuf field map attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAttributes($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->attributes = $arr; + + return $this; + } + + /** + * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT + * token as an `Authorization` header in the HTTP request for every pushed + * message. + * + * Generated from protobuf field .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\PushConfig\OidcToken|null + */ + public function getOidcToken() + { + return $this->readOneof(3); + } + + public function hasOidcToken() + { + return $this->hasOneof(3); + } + + /** + * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT + * token as an `Authorization` header in the HTTP request for every pushed + * message. + * + * Generated from protobuf field .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\PushConfig\OidcToken $var + * @return $this + */ + public function setOidcToken($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PushConfig\OidcToken::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Optional. When set, the payload to the push endpoint is in the form of + * the JSON representation of a PubsubMessage + * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage). + * + * Generated from protobuf field .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\PushConfig\PubsubWrapper|null + */ + public function getPubsubWrapper() + { + return $this->readOneof(4); + } + + public function hasPubsubWrapper() + { + return $this->hasOneof(4); + } + + /** + * Optional. When set, the payload to the push endpoint is in the form of + * the JSON representation of a PubsubMessage + * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage). + * + * Generated from protobuf field .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\PushConfig\PubsubWrapper $var + * @return $this + */ + public function setPubsubWrapper($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PushConfig\PubsubWrapper::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Optional. When set, the payload to the push endpoint is not wrapped. + * + * Generated from protobuf field .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\PushConfig\NoWrapper|null + */ + public function getNoWrapper() + { + return $this->readOneof(5); + } + + public function hasNoWrapper() + { + return $this->hasOneof(5); + } + + /** + * Optional. When set, the payload to the push endpoint is not wrapped. + * + * Generated from protobuf field .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\PushConfig\NoWrapper $var + * @return $this + */ + public function setNoWrapper($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PushConfig\NoWrapper::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * @return string + */ + public function getAuthenticationMethod() + { + return $this->whichOneof("authentication_method"); + } + + /** + * @return string + */ + public function getWrapper() + { + return $this->whichOneof("wrapper"); + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/NoWrapper.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/NoWrapper.php new file mode 100644 index 000000000000..ccb4573e0a1c --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/NoWrapper.php @@ -0,0 +1,78 @@ +google.pubsub.v1.PushConfig.NoWrapper + */ +class NoWrapper extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. When true, writes the Pub/Sub message metadata to + * `x-goog-pubsub-:` headers of the HTTP request. Writes the + * Pub/Sub message attributes to `:` headers of the HTTP request. + * + * Generated from protobuf field bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $write_metadata = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $write_metadata + * Optional. When true, writes the Pub/Sub message metadata to + * `x-goog-pubsub-:` headers of the HTTP request. Writes the + * Pub/Sub message attributes to `:` headers of the HTTP request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. When true, writes the Pub/Sub message metadata to + * `x-goog-pubsub-:` headers of the HTTP request. Writes the + * Pub/Sub message attributes to `:` headers of the HTTP request. + * + * Generated from protobuf field bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getWriteMetadata() + { + return $this->write_metadata; + } + + /** + * Optional. When true, writes the Pub/Sub message metadata to + * `x-goog-pubsub-:` headers of the HTTP request. Writes the + * Pub/Sub message attributes to `:` headers of the HTTP request. + * + * Generated from protobuf field bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setWriteMetadata($var) + { + GPBUtil::checkBool($var); + $this->write_metadata = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(NoWrapper::class, \Google\Cloud\PubSub\V1\PushConfig_NoWrapper::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/OidcToken.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/OidcToken.php new file mode 100644 index 000000000000..b9558bb3a7d4 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/OidcToken.php @@ -0,0 +1,146 @@ +google.pubsub.v1.PushConfig.OidcToken + */ +class OidcToken extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. [Service account + * email](https://cloud.google.com/iam/docs/service-accounts) + * used for generating the OIDC token. For more information + * on setting up authentication, see + * [Push subscriptions](https://cloud.google.com/pubsub/docs/push). + * + * Generated from protobuf field string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_account_email = ''; + /** + * Optional. Audience to be used when generating OIDC token. The audience + * claim identifies the recipients that the JWT is intended for. The + * audience value is a single case-sensitive string. Having multiple values + * (array) for the audience field is not supported. More info about the OIDC + * JWT token audience here: + * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, + * the Push endpoint URL will be used. + * + * Generated from protobuf field string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $audience = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service_account_email + * Optional. [Service account + * email](https://cloud.google.com/iam/docs/service-accounts) + * used for generating the OIDC token. For more information + * on setting up authentication, see + * [Push subscriptions](https://cloud.google.com/pubsub/docs/push). + * @type string $audience + * Optional. Audience to be used when generating OIDC token. The audience + * claim identifies the recipients that the JWT is intended for. The + * audience value is a single case-sensitive string. Having multiple values + * (array) for the audience field is not supported. More info about the OIDC + * JWT token audience here: + * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, + * the Push endpoint URL will be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. [Service account + * email](https://cloud.google.com/iam/docs/service-accounts) + * used for generating the OIDC token. For more information + * on setting up authentication, see + * [Push subscriptions](https://cloud.google.com/pubsub/docs/push). + * + * Generated from protobuf field string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getServiceAccountEmail() + { + return $this->service_account_email; + } + + /** + * Optional. [Service account + * email](https://cloud.google.com/iam/docs/service-accounts) + * used for generating the OIDC token. For more information + * on setting up authentication, see + * [Push subscriptions](https://cloud.google.com/pubsub/docs/push). + * + * Generated from protobuf field string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setServiceAccountEmail($var) + { + GPBUtil::checkString($var, True); + $this->service_account_email = $var; + + return $this; + } + + /** + * Optional. Audience to be used when generating OIDC token. The audience + * claim identifies the recipients that the JWT is intended for. The + * audience value is a single case-sensitive string. Having multiple values + * (array) for the audience field is not supported. More info about the OIDC + * JWT token audience here: + * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, + * the Push endpoint URL will be used. + * + * Generated from protobuf field string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getAudience() + { + return $this->audience; + } + + /** + * Optional. Audience to be used when generating OIDC token. The audience + * claim identifies the recipients that the JWT is intended for. The + * audience value is a single case-sensitive string. Having multiple values + * (array) for the audience field is not supported. More info about the OIDC + * JWT token audience here: + * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, + * the Push endpoint URL will be used. + * + * Generated from protobuf field string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setAudience($var) + { + GPBUtil::checkString($var, True); + $this->audience = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(OidcToken::class, \Google\Cloud\PubSub\V1\PushConfig_OidcToken::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/PubsubWrapper.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/PubsubWrapper.php new file mode 100644 index 000000000000..5053bfb85784 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/PubsubWrapper.php @@ -0,0 +1,38 @@ +google.pubsub.v1.PushConfig.PubsubWrapper + */ +class PubsubWrapper extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PubsubWrapper::class, \Google\Cloud\PubSub\V1\PushConfig_PubsubWrapper::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ReceivedMessage.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ReceivedMessage.php new file mode 100644 index 000000000000..3531a302af63 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ReceivedMessage.php @@ -0,0 +1,189 @@ +google.pubsub.v1.ReceivedMessage + */ +class ReceivedMessage extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. This ID can be used to acknowledge the received message. + * + * Generated from protobuf field string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ack_id = ''; + /** + * Optional. The message. + * + * Generated from protobuf field .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $message = null; + /** + * Optional. The approximate number of times that Pub/Sub has attempted to + * deliver the associated message to a subscriber. + * More precisely, this is 1 + (number of NACKs) + + * (number of ack_deadline exceeds) for this message. + * A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline + * exceeds event is whenever a message is not acknowledged within + * ack_deadline. Note that ack_deadline is initially + * Subscription.ackDeadlineSeconds, but may get extended automatically by + * the client library. + * Upon the first delivery of a given message, `delivery_attempt` will have a + * value of 1. The value is calculated at best effort and is approximate. + * If a DeadLetterPolicy is not set on the subscription, this will be 0. + * + * Generated from protobuf field int32 delivery_attempt = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $delivery_attempt = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $ack_id + * Optional. This ID can be used to acknowledge the received message. + * @type \Google\Cloud\PubSub\V1\PubsubMessage $message + * Optional. The message. + * @type int $delivery_attempt + * Optional. The approximate number of times that Pub/Sub has attempted to + * deliver the associated message to a subscriber. + * More precisely, this is 1 + (number of NACKs) + + * (number of ack_deadline exceeds) for this message. + * A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline + * exceeds event is whenever a message is not acknowledged within + * ack_deadline. Note that ack_deadline is initially + * Subscription.ackDeadlineSeconds, but may get extended automatically by + * the client library. + * Upon the first delivery of a given message, `delivery_attempt` will have a + * value of 1. The value is calculated at best effort and is approximate. + * If a DeadLetterPolicy is not set on the subscription, this will be 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. This ID can be used to acknowledge the received message. + * + * Generated from protobuf field string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getAckId() + { + return $this->ack_id; + } + + /** + * Optional. This ID can be used to acknowledge the received message. + * + * Generated from protobuf field string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setAckId($var) + { + GPBUtil::checkString($var, True); + $this->ack_id = $var; + + return $this; + } + + /** + * Optional. The message. + * + * Generated from protobuf field .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\PubsubMessage|null + */ + public function getMessage() + { + return $this->message; + } + + public function hasMessage() + { + return isset($this->message); + } + + public function clearMessage() + { + unset($this->message); + } + + /** + * Optional. The message. + * + * Generated from protobuf field .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\PubsubMessage $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PubsubMessage::class); + $this->message = $var; + + return $this; + } + + /** + * Optional. The approximate number of times that Pub/Sub has attempted to + * deliver the associated message to a subscriber. + * More precisely, this is 1 + (number of NACKs) + + * (number of ack_deadline exceeds) for this message. + * A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline + * exceeds event is whenever a message is not acknowledged within + * ack_deadline. Note that ack_deadline is initially + * Subscription.ackDeadlineSeconds, but may get extended automatically by + * the client library. + * Upon the first delivery of a given message, `delivery_attempt` will have a + * value of 1. The value is calculated at best effort and is approximate. + * If a DeadLetterPolicy is not set on the subscription, this will be 0. + * + * Generated from protobuf field int32 delivery_attempt = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getDeliveryAttempt() + { + return $this->delivery_attempt; + } + + /** + * Optional. The approximate number of times that Pub/Sub has attempted to + * deliver the associated message to a subscriber. + * More precisely, this is 1 + (number of NACKs) + + * (number of ack_deadline exceeds) for this message. + * A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline + * exceeds event is whenever a message is not acknowledged within + * ack_deadline. Note that ack_deadline is initially + * Subscription.ackDeadlineSeconds, but may get extended automatically by + * the client library. + * Upon the first delivery of a given message, `delivery_attempt` will have a + * value of 1. The value is calculated at best effort and is approximate. + * If a DeadLetterPolicy is not set on the subscription, this will be 0. + * + * Generated from protobuf field int32 delivery_attempt = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setDeliveryAttempt($var) + { + GPBUtil::checkInt32($var); + $this->delivery_attempt = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RetryPolicy.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RetryPolicy.php new file mode 100644 index 000000000000..db6cf2e3d739 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RetryPolicy.php @@ -0,0 +1,140 @@ +google.pubsub.v1.RetryPolicy + */ +class RetryPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The minimum delay between consecutive deliveries of a given + * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. + * + * Generated from protobuf field .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $minimum_backoff = null; + /** + * Optional. The maximum delay between consecutive deliveries of a given + * message. Value should be between 0 and 600 seconds. Defaults to 600 + * seconds. + * + * Generated from protobuf field .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $maximum_backoff = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $minimum_backoff + * Optional. The minimum delay between consecutive deliveries of a given + * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. + * @type \Google\Protobuf\Duration $maximum_backoff + * Optional. The maximum delay between consecutive deliveries of a given + * message. Value should be between 0 and 600 seconds. Defaults to 600 + * seconds. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The minimum delay between consecutive deliveries of a given + * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. + * + * Generated from protobuf field .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getMinimumBackoff() + { + return $this->minimum_backoff; + } + + public function hasMinimumBackoff() + { + return isset($this->minimum_backoff); + } + + public function clearMinimumBackoff() + { + unset($this->minimum_backoff); + } + + /** + * Optional. The minimum delay between consecutive deliveries of a given + * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. + * + * Generated from protobuf field .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMinimumBackoff($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->minimum_backoff = $var; + + return $this; + } + + /** + * Optional. The maximum delay between consecutive deliveries of a given + * message. Value should be between 0 and 600 seconds. Defaults to 600 + * seconds. + * + * Generated from protobuf field .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getMaximumBackoff() + { + return $this->maximum_backoff; + } + + public function hasMaximumBackoff() + { + return isset($this->maximum_backoff); + } + + public function clearMaximumBackoff() + { + unset($this->maximum_backoff); + } + + /** + * Optional. The maximum delay between consecutive deliveries of a given + * message. Value should be between 0 and 600 seconds. Defaults to 600 + * seconds. + * + * Generated from protobuf field .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMaximumBackoff($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->maximum_backoff = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RollbackSchemaRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RollbackSchemaRequest.php new file mode 100644 index 000000000000..2bf316de83de --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RollbackSchemaRequest.php @@ -0,0 +1,128 @@ +google.pubsub.v1.RollbackSchemaRequest + */ +class RollbackSchemaRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The schema being rolled back with revision id. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The revision ID to roll back to. + * It must be a revision of the same schema. + * Example: c7cfa2a8 + * + * Generated from protobuf field string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $revision_id = ''; + + /** + * @param string $name Required. The schema being rolled back with revision id. Please see + * {@see SchemaServiceClient::schemaName()} for help formatting this field. + * @param string $revisionId Required. The revision ID to roll back to. + * It must be a revision of the same schema. + * + * Example: c7cfa2a8 + * + * @return \Google\Cloud\PubSub\V1\RollbackSchemaRequest + * + * @experimental + */ + public static function build(string $name, string $revisionId): self + { + return (new self()) + ->setName($name) + ->setRevisionId($revisionId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The schema being rolled back with revision id. + * @type string $revision_id + * Required. The revision ID to roll back to. + * It must be a revision of the same schema. + * Example: c7cfa2a8 + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + + /** + * Required. The schema being rolled back with revision id. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The schema being rolled back with revision id. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The revision ID to roll back to. + * It must be a revision of the same schema. + * Example: c7cfa2a8 + * + * Generated from protobuf field string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getRevisionId() + { + return $this->revision_id; + } + + /** + * Required. The revision ID to roll back to. + * It must be a revision of the same schema. + * Example: c7cfa2a8 + * + * Generated from protobuf field string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->revision_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema.php new file mode 100644 index 000000000000..9521db88c5ad --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema.php @@ -0,0 +1,225 @@ +google.pubsub.v1.Schema + */ +class Schema extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the schema. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * The type of the schema definition. + * + * Generated from protobuf field .google.pubsub.v1.Schema.Type type = 2; + */ + protected $type = 0; + /** + * The definition of the schema. This should contain a string representing + * the full definition of the schema that is a valid schema definition of + * the type specified in `type`. + * + * Generated from protobuf field string definition = 3; + */ + protected $definition = ''; + /** + * Output only. Immutable. The revision ID of the schema. + * + * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $revision_id = ''; + /** + * Output only. The timestamp that the revision was created. + * + * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $revision_create_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the schema. + * Format is `projects/{project}/schemas/{schema}`. + * @type int $type + * The type of the schema definition. + * @type string $definition + * The definition of the schema. This should contain a string representing + * the full definition of the schema that is a valid schema definition of + * the type specified in `type`. + * @type string $revision_id + * Output only. Immutable. The revision ID of the schema. + * @type \Google\Protobuf\Timestamp $revision_create_time + * Output only. The timestamp that the revision was created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the schema. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the schema. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The type of the schema definition. + * + * Generated from protobuf field .google.pubsub.v1.Schema.Type type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of the schema definition. + * + * Generated from protobuf field .google.pubsub.v1.Schema.Type type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\Schema\Type::class); + $this->type = $var; + + return $this; + } + + /** + * The definition of the schema. This should contain a string representing + * the full definition of the schema that is a valid schema definition of + * the type specified in `type`. + * + * Generated from protobuf field string definition = 3; + * @return string + */ + public function getDefinition() + { + return $this->definition; + } + + /** + * The definition of the schema. This should contain a string representing + * the full definition of the schema that is a valid schema definition of + * the type specified in `type`. + * + * Generated from protobuf field string definition = 3; + * @param string $var + * @return $this + */ + public function setDefinition($var) + { + GPBUtil::checkString($var, True); + $this->definition = $var; + + return $this; + } + + /** + * Output only. Immutable. The revision ID of the schema. + * + * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRevisionId() + { + return $this->revision_id; + } + + /** + * Output only. Immutable. The revision ID of the schema. + * + * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->revision_id = $var; + + return $this; + } + + /** + * Output only. The timestamp that the revision was created. + * + * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getRevisionCreateTime() + { + return $this->revision_create_time; + } + + public function hasRevisionCreateTime() + { + return isset($this->revision_create_time); + } + + public function clearRevisionCreateTime() + { + unset($this->revision_create_time); + } + + /** + * Output only. The timestamp that the revision was created. + * + * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setRevisionCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->revision_create_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema/Type.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema/Type.php new file mode 100644 index 000000000000..31945e1e640b --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema/Type.php @@ -0,0 +1,64 @@ +google.pubsub.v1.Schema.Type + */ +class Type +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * A Protocol Buffer schema definition. + * + * Generated from protobuf enum PROTOCOL_BUFFER = 1; + */ + const PROTOCOL_BUFFER = 1; + /** + * An Avro schema definition. + * + * Generated from protobuf enum AVRO = 2; + */ + const AVRO = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::PROTOCOL_BUFFER => 'PROTOCOL_BUFFER', + self::AVRO => 'AVRO', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\PubSub\V1\Schema_Type::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaSettings.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaSettings.php new file mode 100644 index 000000000000..f32a917284c2 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaSettings.php @@ -0,0 +1,197 @@ +google.pubsub.v1.SchemaSettings + */ +class SchemaSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the schema that messages published should be + * validated against. Format is `projects/{project}/schemas/{schema}`. The + * value of this field will be `_deleted-schema_` if the schema has been + * deleted. + * + * Generated from protobuf field string schema = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $schema = ''; + /** + * Optional. The encoding of messages validated against `schema`. + * + * Generated from protobuf field .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encoding = 0; + /** + * Optional. The minimum (inclusive) revision allowed for validating messages. + * If empty or not present, allow any revision to be validated against + * last_revision or any revision created before. + * + * Generated from protobuf field string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $first_revision_id = ''; + /** + * Optional. The maximum (inclusive) revision allowed for validating messages. + * If empty or not present, allow any revision to be validated against + * first_revision or any revision created after. + * + * Generated from protobuf field string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $last_revision_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $schema + * Required. The name of the schema that messages published should be + * validated against. Format is `projects/{project}/schemas/{schema}`. The + * value of this field will be `_deleted-schema_` if the schema has been + * deleted. + * @type int $encoding + * Optional. The encoding of messages validated against `schema`. + * @type string $first_revision_id + * Optional. The minimum (inclusive) revision allowed for validating messages. + * If empty or not present, allow any revision to be validated against + * last_revision or any revision created before. + * @type string $last_revision_id + * Optional. The maximum (inclusive) revision allowed for validating messages. + * If empty or not present, allow any revision to be validated against + * first_revision or any revision created after. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the schema that messages published should be + * validated against. Format is `projects/{project}/schemas/{schema}`. The + * value of this field will be `_deleted-schema_` if the schema has been + * deleted. + * + * Generated from protobuf field string schema = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSchema() + { + return $this->schema; + } + + /** + * Required. The name of the schema that messages published should be + * validated against. Format is `projects/{project}/schemas/{schema}`. The + * value of this field will be `_deleted-schema_` if the schema has been + * deleted. + * + * Generated from protobuf field string schema = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSchema($var) + { + GPBUtil::checkString($var, True); + $this->schema = $var; + + return $this; + } + + /** + * Optional. The encoding of messages validated against `schema`. + * + * Generated from protobuf field .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getEncoding() + { + return $this->encoding; + } + + /** + * Optional. The encoding of messages validated against `schema`. + * + * Generated from protobuf field .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setEncoding($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\Encoding::class); + $this->encoding = $var; + + return $this; + } + + /** + * Optional. The minimum (inclusive) revision allowed for validating messages. + * If empty or not present, allow any revision to be validated against + * last_revision or any revision created before. + * + * Generated from protobuf field string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFirstRevisionId() + { + return $this->first_revision_id; + } + + /** + * Optional. The minimum (inclusive) revision allowed for validating messages. + * If empty or not present, allow any revision to be validated against + * last_revision or any revision created before. + * + * Generated from protobuf field string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFirstRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->first_revision_id = $var; + + return $this; + } + + /** + * Optional. The maximum (inclusive) revision allowed for validating messages. + * If empty or not present, allow any revision to be validated against + * first_revision or any revision created after. + * + * Generated from protobuf field string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getLastRevisionId() + { + return $this->last_revision_id; + } + + /** + * Optional. The maximum (inclusive) revision allowed for validating messages. + * If empty or not present, allow any revision to be validated against + * first_revision or any revision created after. + * + * Generated from protobuf field string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setLastRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->last_revision_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaView.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaView.php new file mode 100644 index 000000000000..5434e27c62b5 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaView.php @@ -0,0 +1,62 @@ +google.pubsub.v1.SchemaView + */ +class SchemaView +{ + /** + * The default / unset value. + * The API will default to the BASIC view. + * + * Generated from protobuf enum SCHEMA_VIEW_UNSPECIFIED = 0; + */ + const SCHEMA_VIEW_UNSPECIFIED = 0; + /** + * Include the name and type of the schema, but not the definition. + * + * Generated from protobuf enum BASIC = 1; + */ + const BASIC = 1; + /** + * Include all Schema object fields. + * + * Generated from protobuf enum FULL = 2; + */ + const FULL = 2; + + private static $valueToName = [ + self::SCHEMA_VIEW_UNSPECIFIED => 'SCHEMA_VIEW_UNSPECIFIED', + self::BASIC => 'BASIC', + self::FULL => 'FULL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekRequest.php new file mode 100644 index 000000000000..0f726f6024ef --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekRequest.php @@ -0,0 +1,178 @@ +google.pubsub.v1.SeekRequest + */ +class SeekRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The subscription to affect. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $subscription = ''; + protected $target; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subscription + * Required. The subscription to affect. + * @type \Google\Protobuf\Timestamp $time + * Optional. The time to seek to. + * Messages retained in the subscription that were published before this + * time are marked as acknowledged, and messages retained in the + * subscription that were published after this time are marked as + * unacknowledged. Note that this operation affects only those messages + * retained in the subscription (configured by the combination of + * `message_retention_duration` and `retain_acked_messages`). For example, + * if `time` corresponds to a point before the message retention + * window (or to a point before the system's notion of the subscription + * creation time), only retained messages will be marked as unacknowledged, + * and already-expunged messages will not be restored. + * @type string $snapshot + * Optional. The snapshot to seek to. The snapshot's topic must be the same + * as that of the provided subscription. Format is + * `projects/{project}/snapshots/{snap}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The subscription to affect. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSubscription() + { + return $this->subscription; + } + + /** + * Required. The subscription to affect. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSubscription($var) + { + GPBUtil::checkString($var, True); + $this->subscription = $var; + + return $this; + } + + /** + * Optional. The time to seek to. + * Messages retained in the subscription that were published before this + * time are marked as acknowledged, and messages retained in the + * subscription that were published after this time are marked as + * unacknowledged. Note that this operation affects only those messages + * retained in the subscription (configured by the combination of + * `message_retention_duration` and `retain_acked_messages`). For example, + * if `time` corresponds to a point before the message retention + * window (or to a point before the system's notion of the subscription + * creation time), only retained messages will be marked as unacknowledged, + * and already-expunged messages will not be restored. + * + * Generated from protobuf field .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getTime() + { + return $this->readOneof(2); + } + + public function hasTime() + { + return $this->hasOneof(2); + } + + /** + * Optional. The time to seek to. + * Messages retained in the subscription that were published before this + * time are marked as acknowledged, and messages retained in the + * subscription that were published after this time are marked as + * unacknowledged. Note that this operation affects only those messages + * retained in the subscription (configured by the combination of + * `message_retention_duration` and `retain_acked_messages`). For example, + * if `time` corresponds to a point before the message retention + * window (or to a point before the system's notion of the subscription + * creation time), only retained messages will be marked as unacknowledged, + * and already-expunged messages will not be restored. + * + * Generated from protobuf field .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Optional. The snapshot to seek to. The snapshot's topic must be the same + * as that of the provided subscription. Format is + * `projects/{project}/snapshots/{snap}`. + * + * Generated from protobuf field string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getSnapshot() + { + return $this->readOneof(3); + } + + public function hasSnapshot() + { + return $this->hasOneof(3); + } + + /** + * Optional. The snapshot to seek to. The snapshot's topic must be the same + * as that of the provided subscription. Format is + * `projects/{project}/snapshots/{snap}`. + * + * Generated from protobuf field string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSnapshot($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getTarget() + { + return $this->whichOneof("target"); + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekResponse.php new file mode 100644 index 000000000000..cf1f98bba3c0 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekResponse.php @@ -0,0 +1,33 @@ +google.pubsub.v1.SeekResponse + */ +class SeekResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Snapshot.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Snapshot.php new file mode 100644 index 000000000000..0861e885aad5 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Snapshot.php @@ -0,0 +1,227 @@ +google.pubsub.v1.Snapshot + */ +class Snapshot extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The name of the snapshot. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $name = ''; + /** + * Optional. The name of the topic from which this snapshot is retaining + * messages. + * + * Generated from protobuf field string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $topic = ''; + /** + * Optional. The snapshot is guaranteed to exist up until this time. + * A newly-created snapshot expires no later than 7 days from the time of its + * creation. Its exact lifetime is determined at creation by the existing + * backlog in the source subscription. Specifically, the lifetime of the + * snapshot is `7 days - (age of oldest unacked message in the subscription)`. + * For example, consider a subscription whose oldest unacked message is 3 days + * old. If a snapshot is created from this subscription, the snapshot -- which + * will always capture this 3-day-old backlog as long as the snapshot + * exists -- will expire in 4 days. The service will refuse to create a + * snapshot that would expire in less than 1 hour after creation. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $expire_time = null; + /** + * Optional. See [Creating and managing labels] + * (https://cloud.google.com/pubsub/docs/labels). + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Optional. The name of the snapshot. + * @type string $topic + * Optional. The name of the topic from which this snapshot is retaining + * messages. + * @type \Google\Protobuf\Timestamp $expire_time + * Optional. The snapshot is guaranteed to exist up until this time. + * A newly-created snapshot expires no later than 7 days from the time of its + * creation. Its exact lifetime is determined at creation by the existing + * backlog in the source subscription. Specifically, the lifetime of the + * snapshot is `7 days - (age of oldest unacked message in the subscription)`. + * For example, consider a subscription whose oldest unacked message is 3 days + * old. If a snapshot is created from this subscription, the snapshot -- which + * will always capture this 3-day-old backlog as long as the snapshot + * exists -- will expire in 4 days. The service will refuse to create a + * snapshot that would expire in less than 1 hour after creation. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. See [Creating and managing labels] + * (https://cloud.google.com/pubsub/docs/labels). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The name of the snapshot. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Optional. The name of the snapshot. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The name of the topic from which this snapshot is retaining + * messages. + * + * Generated from protobuf field string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getTopic() + { + return $this->topic; + } + + /** + * Optional. The name of the topic from which this snapshot is retaining + * messages. + * + * Generated from protobuf field string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTopic($var) + { + GPBUtil::checkString($var, True); + $this->topic = $var; + + return $this; + } + + /** + * Optional. The snapshot is guaranteed to exist up until this time. + * A newly-created snapshot expires no later than 7 days from the time of its + * creation. Its exact lifetime is determined at creation by the existing + * backlog in the source subscription. Specifically, the lifetime of the + * snapshot is `7 days - (age of oldest unacked message in the subscription)`. + * For example, consider a subscription whose oldest unacked message is 3 days + * old. If a snapshot is created from this subscription, the snapshot -- which + * will always capture this 3-day-old backlog as long as the snapshot + * exists -- will expire in 4 days. The service will refuse to create a + * snapshot that would expire in less than 1 hour after creation. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpireTime() + { + return $this->expire_time; + } + + public function hasExpireTime() + { + return isset($this->expire_time); + } + + public function clearExpireTime() + { + unset($this->expire_time); + } + + /** + * Optional. The snapshot is guaranteed to exist up until this time. + * A newly-created snapshot expires no later than 7 days from the time of its + * creation. Its exact lifetime is determined at creation by the existing + * backlog in the source subscription. Specifically, the lifetime of the + * snapshot is `7 days - (age of oldest unacked message in the subscription)`. + * For example, consider a subscription whose oldest unacked message is 3 days + * old. If a snapshot is created from this subscription, the snapshot -- which + * will always capture this 3-day-old backlog as long as the snapshot + * exists -- will expire in 4 days. The service will refuse to create a + * snapshot that would expire in less than 1 hour after creation. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expire_time = $var; + + return $this; + } + + /** + * Optional. See [Creating and managing labels] + * (https://cloud.google.com/pubsub/docs/labels). + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. See [Creating and managing labels] + * (https://cloud.google.com/pubsub/docs/labels). + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullRequest.php new file mode 100644 index 000000000000..f51c899b073f --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullRequest.php @@ -0,0 +1,491 @@ +google.pubsub.v1.StreamingPullRequest + */ +class StreamingPullRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The subscription for which to initialize the new stream. This + * must be provided in the first request on the stream, and must not be set in + * subsequent requests from client to server. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $subscription = ''; + /** + * Optional. List of acknowledgement IDs for acknowledging previously received + * messages (received on this stream or a different stream). If an ack ID has + * expired, the corresponding message may be redelivered later. Acknowledging + * a message more than once will not result in an error. If the + * acknowledgement ID is malformed, the stream will be aborted with status + * `INVALID_ARGUMENT`. + * + * Generated from protobuf field repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $ack_ids; + /** + * Optional. The list of new ack deadlines for the IDs listed in + * `modify_deadline_ack_ids`. The size of this list must be the same as the + * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted + * with `INVALID_ARGUMENT`. Each element in this list is applied to the + * element in the same position in `modify_deadline_ack_ids`. The new ack + * deadline is with respect to the time this request was sent to the Pub/Sub + * system. Must be >= 0. For example, if the value is 10, the new ack deadline + * will expire 10 seconds after this request is received. If the value is 0, + * the message is immediately made available for another streaming or + * non-streaming pull request. If the value is < 0 (an error), the stream will + * be aborted with status `INVALID_ARGUMENT`. + * + * Generated from protobuf field repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $modify_deadline_seconds; + /** + * Optional. List of acknowledgement IDs whose deadline will be modified based + * on the corresponding element in `modify_deadline_seconds`. This field can + * be used to indicate that more time is needed to process a message by the + * subscriber, or to make the message available for redelivery if the + * processing was interrupted. + * + * Generated from protobuf field repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $modify_deadline_ack_ids; + /** + * Required. The ack deadline to use for the stream. This must be provided in + * the first request on the stream, but it can also be updated on subsequent + * requests from client to server. The minimum deadline you can specify is 10 + * seconds. The maximum deadline you can specify is 600 seconds (10 minutes). + * + * Generated from protobuf field int32 stream_ack_deadline_seconds = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $stream_ack_deadline_seconds = 0; + /** + * Optional. A unique identifier that is used to distinguish client instances + * from each other. Only needs to be provided on the initial request. When a + * stream disconnects and reconnects for the same stream, the client_id should + * be set to the same value so that state associated with the old stream can + * be transferred to the new stream. The same client_id should not be used for + * different client instances. + * + * Generated from protobuf field string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $client_id = ''; + /** + * Optional. Flow control settings for the maximum number of outstanding + * messages. When there are `max_outstanding_messages` currently sent to the + * streaming pull client that have not yet been acked or nacked, the server + * stops sending more messages. The sending of messages resumes once the + * number of outstanding messages is less than this value. If the value is + * <= 0, there is no limit to the number of outstanding messages. This + * property can only be set on the initial StreamingPullRequest. If it is set + * on a subsequent request, the stream will be aborted with status + * `INVALID_ARGUMENT`. + * + * Generated from protobuf field int64 max_outstanding_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $max_outstanding_messages = 0; + /** + * Optional. Flow control settings for the maximum number of outstanding + * bytes. When there are `max_outstanding_bytes` or more worth of messages + * currently sent to the streaming pull client that have not yet been acked or + * nacked, the server will stop sending more messages. The sending of messages + * resumes once the number of outstanding bytes is less than this value. If + * the value is <= 0, there is no limit to the number of outstanding bytes. + * This property can only be set on the initial StreamingPullRequest. If it is + * set on a subsequent request, the stream will be aborted with status + * `INVALID_ARGUMENT`. + * + * Generated from protobuf field int64 max_outstanding_bytes = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $max_outstanding_bytes = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subscription + * Required. The subscription for which to initialize the new stream. This + * must be provided in the first request on the stream, and must not be set in + * subsequent requests from client to server. + * Format is `projects/{project}/subscriptions/{sub}`. + * @type array|\Google\Protobuf\Internal\RepeatedField $ack_ids + * Optional. List of acknowledgement IDs for acknowledging previously received + * messages (received on this stream or a different stream). If an ack ID has + * expired, the corresponding message may be redelivered later. Acknowledging + * a message more than once will not result in an error. If the + * acknowledgement ID is malformed, the stream will be aborted with status + * `INVALID_ARGUMENT`. + * @type array|\Google\Protobuf\Internal\RepeatedField $modify_deadline_seconds + * Optional. The list of new ack deadlines for the IDs listed in + * `modify_deadline_ack_ids`. The size of this list must be the same as the + * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted + * with `INVALID_ARGUMENT`. Each element in this list is applied to the + * element in the same position in `modify_deadline_ack_ids`. The new ack + * deadline is with respect to the time this request was sent to the Pub/Sub + * system. Must be >= 0. For example, if the value is 10, the new ack deadline + * will expire 10 seconds after this request is received. If the value is 0, + * the message is immediately made available for another streaming or + * non-streaming pull request. If the value is < 0 (an error), the stream will + * be aborted with status `INVALID_ARGUMENT`. + * @type array|\Google\Protobuf\Internal\RepeatedField $modify_deadline_ack_ids + * Optional. List of acknowledgement IDs whose deadline will be modified based + * on the corresponding element in `modify_deadline_seconds`. This field can + * be used to indicate that more time is needed to process a message by the + * subscriber, or to make the message available for redelivery if the + * processing was interrupted. + * @type int $stream_ack_deadline_seconds + * Required. The ack deadline to use for the stream. This must be provided in + * the first request on the stream, but it can also be updated on subsequent + * requests from client to server. The minimum deadline you can specify is 10 + * seconds. The maximum deadline you can specify is 600 seconds (10 minutes). + * @type string $client_id + * Optional. A unique identifier that is used to distinguish client instances + * from each other. Only needs to be provided on the initial request. When a + * stream disconnects and reconnects for the same stream, the client_id should + * be set to the same value so that state associated with the old stream can + * be transferred to the new stream. The same client_id should not be used for + * different client instances. + * @type int|string $max_outstanding_messages + * Optional. Flow control settings for the maximum number of outstanding + * messages. When there are `max_outstanding_messages` currently sent to the + * streaming pull client that have not yet been acked or nacked, the server + * stops sending more messages. The sending of messages resumes once the + * number of outstanding messages is less than this value. If the value is + * <= 0, there is no limit to the number of outstanding messages. This + * property can only be set on the initial StreamingPullRequest. If it is set + * on a subsequent request, the stream will be aborted with status + * `INVALID_ARGUMENT`. + * @type int|string $max_outstanding_bytes + * Optional. Flow control settings for the maximum number of outstanding + * bytes. When there are `max_outstanding_bytes` or more worth of messages + * currently sent to the streaming pull client that have not yet been acked or + * nacked, the server will stop sending more messages. The sending of messages + * resumes once the number of outstanding bytes is less than this value. If + * the value is <= 0, there is no limit to the number of outstanding bytes. + * This property can only be set on the initial StreamingPullRequest. If it is + * set on a subsequent request, the stream will be aborted with status + * `INVALID_ARGUMENT`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The subscription for which to initialize the new stream. This + * must be provided in the first request on the stream, and must not be set in + * subsequent requests from client to server. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSubscription() + { + return $this->subscription; + } + + /** + * Required. The subscription for which to initialize the new stream. This + * must be provided in the first request on the stream, and must not be set in + * subsequent requests from client to server. + * Format is `projects/{project}/subscriptions/{sub}`. + * + * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSubscription($var) + { + GPBUtil::checkString($var, True); + $this->subscription = $var; + + return $this; + } + + /** + * Optional. List of acknowledgement IDs for acknowledging previously received + * messages (received on this stream or a different stream). If an ack ID has + * expired, the corresponding message may be redelivered later. Acknowledging + * a message more than once will not result in an error. If the + * acknowledgement ID is malformed, the stream will be aborted with status + * `INVALID_ARGUMENT`. + * + * Generated from protobuf field repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAckIds() + { + return $this->ack_ids; + } + + /** + * Optional. List of acknowledgement IDs for acknowledging previously received + * messages (received on this stream or a different stream). If an ack ID has + * expired, the corresponding message may be redelivered later. Acknowledging + * a message more than once will not result in an error. If the + * acknowledgement ID is malformed, the stream will be aborted with status + * `INVALID_ARGUMENT`. + * + * Generated from protobuf field repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAckIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->ack_ids = $arr; + + return $this; + } + + /** + * Optional. The list of new ack deadlines for the IDs listed in + * `modify_deadline_ack_ids`. The size of this list must be the same as the + * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted + * with `INVALID_ARGUMENT`. Each element in this list is applied to the + * element in the same position in `modify_deadline_ack_ids`. The new ack + * deadline is with respect to the time this request was sent to the Pub/Sub + * system. Must be >= 0. For example, if the value is 10, the new ack deadline + * will expire 10 seconds after this request is received. If the value is 0, + * the message is immediately made available for another streaming or + * non-streaming pull request. If the value is < 0 (an error), the stream will + * be aborted with status `INVALID_ARGUMENT`. + * + * Generated from protobuf field repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getModifyDeadlineSeconds() + { + return $this->modify_deadline_seconds; + } + + /** + * Optional. The list of new ack deadlines for the IDs listed in + * `modify_deadline_ack_ids`. The size of this list must be the same as the + * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted + * with `INVALID_ARGUMENT`. Each element in this list is applied to the + * element in the same position in `modify_deadline_ack_ids`. The new ack + * deadline is with respect to the time this request was sent to the Pub/Sub + * system. Must be >= 0. For example, if the value is 10, the new ack deadline + * will expire 10 seconds after this request is received. If the value is 0, + * the message is immediately made available for another streaming or + * non-streaming pull request. If the value is < 0 (an error), the stream will + * be aborted with status `INVALID_ARGUMENT`. + * + * Generated from protobuf field repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setModifyDeadlineSeconds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->modify_deadline_seconds = $arr; + + return $this; + } + + /** + * Optional. List of acknowledgement IDs whose deadline will be modified based + * on the corresponding element in `modify_deadline_seconds`. This field can + * be used to indicate that more time is needed to process a message by the + * subscriber, or to make the message available for redelivery if the + * processing was interrupted. + * + * Generated from protobuf field repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getModifyDeadlineAckIds() + { + return $this->modify_deadline_ack_ids; + } + + /** + * Optional. List of acknowledgement IDs whose deadline will be modified based + * on the corresponding element in `modify_deadline_seconds`. This field can + * be used to indicate that more time is needed to process a message by the + * subscriber, or to make the message available for redelivery if the + * processing was interrupted. + * + * Generated from protobuf field repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setModifyDeadlineAckIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->modify_deadline_ack_ids = $arr; + + return $this; + } + + /** + * Required. The ack deadline to use for the stream. This must be provided in + * the first request on the stream, but it can also be updated on subsequent + * requests from client to server. The minimum deadline you can specify is 10 + * seconds. The maximum deadline you can specify is 600 seconds (10 minutes). + * + * Generated from protobuf field int32 stream_ack_deadline_seconds = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getStreamAckDeadlineSeconds() + { + return $this->stream_ack_deadline_seconds; + } + + /** + * Required. The ack deadline to use for the stream. This must be provided in + * the first request on the stream, but it can also be updated on subsequent + * requests from client to server. The minimum deadline you can specify is 10 + * seconds. The maximum deadline you can specify is 600 seconds (10 minutes). + * + * Generated from protobuf field int32 stream_ack_deadline_seconds = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setStreamAckDeadlineSeconds($var) + { + GPBUtil::checkInt32($var); + $this->stream_ack_deadline_seconds = $var; + + return $this; + } + + /** + * Optional. A unique identifier that is used to distinguish client instances + * from each other. Only needs to be provided on the initial request. When a + * stream disconnects and reconnects for the same stream, the client_id should + * be set to the same value so that state associated with the old stream can + * be transferred to the new stream. The same client_id should not be used for + * different client instances. + * + * Generated from protobuf field string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getClientId() + { + return $this->client_id; + } + + /** + * Optional. A unique identifier that is used to distinguish client instances + * from each other. Only needs to be provided on the initial request. When a + * stream disconnects and reconnects for the same stream, the client_id should + * be set to the same value so that state associated with the old stream can + * be transferred to the new stream. The same client_id should not be used for + * different client instances. + * + * Generated from protobuf field string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setClientId($var) + { + GPBUtil::checkString($var, True); + $this->client_id = $var; + + return $this; + } + + /** + * Optional. Flow control settings for the maximum number of outstanding + * messages. When there are `max_outstanding_messages` currently sent to the + * streaming pull client that have not yet been acked or nacked, the server + * stops sending more messages. The sending of messages resumes once the + * number of outstanding messages is less than this value. If the value is + * <= 0, there is no limit to the number of outstanding messages. This + * property can only be set on the initial StreamingPullRequest. If it is set + * on a subsequent request, the stream will be aborted with status + * `INVALID_ARGUMENT`. + * + * Generated from protobuf field int64 max_outstanding_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return int|string + */ + public function getMaxOutstandingMessages() + { + return $this->max_outstanding_messages; + } + + /** + * Optional. Flow control settings for the maximum number of outstanding + * messages. When there are `max_outstanding_messages` currently sent to the + * streaming pull client that have not yet been acked or nacked, the server + * stops sending more messages. The sending of messages resumes once the + * number of outstanding messages is less than this value. If the value is + * <= 0, there is no limit to the number of outstanding messages. This + * property can only be set on the initial StreamingPullRequest. If it is set + * on a subsequent request, the stream will be aborted with status + * `INVALID_ARGUMENT`. + * + * Generated from protobuf field int64 max_outstanding_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param int|string $var + * @return $this + */ + public function setMaxOutstandingMessages($var) + { + GPBUtil::checkInt64($var); + $this->max_outstanding_messages = $var; + + return $this; + } + + /** + * Optional. Flow control settings for the maximum number of outstanding + * bytes. When there are `max_outstanding_bytes` or more worth of messages + * currently sent to the streaming pull client that have not yet been acked or + * nacked, the server will stop sending more messages. The sending of messages + * resumes once the number of outstanding bytes is less than this value. If + * the value is <= 0, there is no limit to the number of outstanding bytes. + * This property can only be set on the initial StreamingPullRequest. If it is + * set on a subsequent request, the stream will be aborted with status + * `INVALID_ARGUMENT`. + * + * Generated from protobuf field int64 max_outstanding_bytes = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return int|string + */ + public function getMaxOutstandingBytes() + { + return $this->max_outstanding_bytes; + } + + /** + * Optional. Flow control settings for the maximum number of outstanding + * bytes. When there are `max_outstanding_bytes` or more worth of messages + * currently sent to the streaming pull client that have not yet been acked or + * nacked, the server will stop sending more messages. The sending of messages + * resumes once the number of outstanding bytes is less than this value. If + * the value is <= 0, there is no limit to the number of outstanding bytes. + * This property can only be set on the initial StreamingPullRequest. If it is + * set on a subsequent request, the stream will be aborted with status + * `INVALID_ARGUMENT`. + * + * Generated from protobuf field int64 max_outstanding_bytes = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param int|string $var + * @return $this + */ + public function setMaxOutstandingBytes($var) + { + GPBUtil::checkInt64($var); + $this->max_outstanding_bytes = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse.php new file mode 100644 index 000000000000..009b14fcc2aa --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse.php @@ -0,0 +1,208 @@ +google.pubsub.v1.StreamingPullResponse + */ +class StreamingPullResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Received Pub/Sub messages. This will not be empty. + * + * Generated from protobuf field repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $received_messages; + /** + * Optional. This field will only be set if `enable_exactly_once_delivery` is + * set to `true`. + * + * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $acknowledge_confirmation = null; + /** + * Optional. This field will only be set if `enable_exactly_once_delivery` is + * set to `true`. + * + * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $modify_ack_deadline_confirmation = null; + /** + * Optional. Properties associated with this subscription. + * + * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $subscription_properties = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\PubSub\V1\ReceivedMessage>|\Google\Protobuf\Internal\RepeatedField $received_messages + * Optional. Received Pub/Sub messages. This will not be empty. + * @type \Google\Cloud\PubSub\V1\StreamingPullResponse\AcknowledgeConfirmation $acknowledge_confirmation + * Optional. This field will only be set if `enable_exactly_once_delivery` is + * set to `true`. + * @type \Google\Cloud\PubSub\V1\StreamingPullResponse\ModifyAckDeadlineConfirmation $modify_ack_deadline_confirmation + * Optional. This field will only be set if `enable_exactly_once_delivery` is + * set to `true`. + * @type \Google\Cloud\PubSub\V1\StreamingPullResponse\SubscriptionProperties $subscription_properties + * Optional. Properties associated with this subscription. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Received Pub/Sub messages. This will not be empty. + * + * Generated from protobuf field repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReceivedMessages() + { + return $this->received_messages; + } + + /** + * Optional. Received Pub/Sub messages. This will not be empty. + * + * Generated from protobuf field repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\PubSub\V1\ReceivedMessage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReceivedMessages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\ReceivedMessage::class); + $this->received_messages = $arr; + + return $this; + } + + /** + * Optional. This field will only be set if `enable_exactly_once_delivery` is + * set to `true`. + * + * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\StreamingPullResponse\AcknowledgeConfirmation|null + */ + public function getAcknowledgeConfirmation() + { + return $this->acknowledge_confirmation; + } + + public function hasAcknowledgeConfirmation() + { + return isset($this->acknowledge_confirmation); + } + + public function clearAcknowledgeConfirmation() + { + unset($this->acknowledge_confirmation); + } + + /** + * Optional. This field will only be set if `enable_exactly_once_delivery` is + * set to `true`. + * + * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\StreamingPullResponse\AcknowledgeConfirmation $var + * @return $this + */ + public function setAcknowledgeConfirmation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\StreamingPullResponse\AcknowledgeConfirmation::class); + $this->acknowledge_confirmation = $var; + + return $this; + } + + /** + * Optional. This field will only be set if `enable_exactly_once_delivery` is + * set to `true`. + * + * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\StreamingPullResponse\ModifyAckDeadlineConfirmation|null + */ + public function getModifyAckDeadlineConfirmation() + { + return $this->modify_ack_deadline_confirmation; + } + + public function hasModifyAckDeadlineConfirmation() + { + return isset($this->modify_ack_deadline_confirmation); + } + + public function clearModifyAckDeadlineConfirmation() + { + unset($this->modify_ack_deadline_confirmation); + } + + /** + * Optional. This field will only be set if `enable_exactly_once_delivery` is + * set to `true`. + * + * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\StreamingPullResponse\ModifyAckDeadlineConfirmation $var + * @return $this + */ + public function setModifyAckDeadlineConfirmation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\StreamingPullResponse\ModifyAckDeadlineConfirmation::class); + $this->modify_ack_deadline_confirmation = $var; + + return $this; + } + + /** + * Optional. Properties associated with this subscription. + * + * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\StreamingPullResponse\SubscriptionProperties|null + */ + public function getSubscriptionProperties() + { + return $this->subscription_properties; + } + + public function hasSubscriptionProperties() + { + return isset($this->subscription_properties); + } + + public function clearSubscriptionProperties() + { + unset($this->subscription_properties); + } + + /** + * Optional. Properties associated with this subscription. + * + * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\StreamingPullResponse\SubscriptionProperties $var + * @return $this + */ + public function setSubscriptionProperties($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\StreamingPullResponse\SubscriptionProperties::class); + $this->subscription_properties = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/AcknowledgeConfirmation.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/AcknowledgeConfirmation.php new file mode 100644 index 000000000000..fd94ce279a93 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/AcknowledgeConfirmation.php @@ -0,0 +1,181 @@ +google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + */ +class AcknowledgeConfirmation extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Successfully processed acknowledgement IDs. + * + * Generated from protobuf field repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $ack_ids; + /** + * Optional. List of acknowledgement IDs that were malformed or whose + * acknowledgement deadline has expired. + * + * Generated from protobuf field repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $invalid_ack_ids; + /** + * Optional. List of acknowledgement IDs that were out of order. + * + * Generated from protobuf field repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $unordered_ack_ids; + /** + * Optional. List of acknowledgement IDs that failed processing with + * temporary issues. + * + * Generated from protobuf field repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $temporary_failed_ack_ids; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $ack_ids + * Optional. Successfully processed acknowledgement IDs. + * @type array|\Google\Protobuf\Internal\RepeatedField $invalid_ack_ids + * Optional. List of acknowledgement IDs that were malformed or whose + * acknowledgement deadline has expired. + * @type array|\Google\Protobuf\Internal\RepeatedField $unordered_ack_ids + * Optional. List of acknowledgement IDs that were out of order. + * @type array|\Google\Protobuf\Internal\RepeatedField $temporary_failed_ack_ids + * Optional. List of acknowledgement IDs that failed processing with + * temporary issues. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Successfully processed acknowledgement IDs. + * + * Generated from protobuf field repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAckIds() + { + return $this->ack_ids; + } + + /** + * Optional. Successfully processed acknowledgement IDs. + * + * Generated from protobuf field repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAckIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->ack_ids = $arr; + + return $this; + } + + /** + * Optional. List of acknowledgement IDs that were malformed or whose + * acknowledgement deadline has expired. + * + * Generated from protobuf field repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInvalidAckIds() + { + return $this->invalid_ack_ids; + } + + /** + * Optional. List of acknowledgement IDs that were malformed or whose + * acknowledgement deadline has expired. + * + * Generated from protobuf field repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInvalidAckIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->invalid_ack_ids = $arr; + + return $this; + } + + /** + * Optional. List of acknowledgement IDs that were out of order. + * + * Generated from protobuf field repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnorderedAckIds() + { + return $this->unordered_ack_ids; + } + + /** + * Optional. List of acknowledgement IDs that were out of order. + * + * Generated from protobuf field repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnorderedAckIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unordered_ack_ids = $arr; + + return $this; + } + + /** + * Optional. List of acknowledgement IDs that failed processing with + * temporary issues. + * + * Generated from protobuf field repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTemporaryFailedAckIds() + { + return $this->temporary_failed_ack_ids; + } + + /** + * Optional. List of acknowledgement IDs that failed processing with + * temporary issues. + * + * Generated from protobuf field repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTemporaryFailedAckIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->temporary_failed_ack_ids = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AcknowledgeConfirmation::class, \Google\Cloud\PubSub\V1\StreamingPullResponse_AcknowledgeConfirmation::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/ModifyAckDeadlineConfirmation.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/ModifyAckDeadlineConfirmation.php new file mode 100644 index 000000000000..1fd67ae753a0 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/ModifyAckDeadlineConfirmation.php @@ -0,0 +1,147 @@ +google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + */ +class ModifyAckDeadlineConfirmation extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Successfully processed acknowledgement IDs. + * + * Generated from protobuf field repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $ack_ids; + /** + * Optional. List of acknowledgement IDs that were malformed or whose + * acknowledgement deadline has expired. + * + * Generated from protobuf field repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $invalid_ack_ids; + /** + * Optional. List of acknowledgement IDs that failed processing with + * temporary issues. + * + * Generated from protobuf field repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $temporary_failed_ack_ids; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $ack_ids + * Optional. Successfully processed acknowledgement IDs. + * @type array|\Google\Protobuf\Internal\RepeatedField $invalid_ack_ids + * Optional. List of acknowledgement IDs that were malformed or whose + * acknowledgement deadline has expired. + * @type array|\Google\Protobuf\Internal\RepeatedField $temporary_failed_ack_ids + * Optional. List of acknowledgement IDs that failed processing with + * temporary issues. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Successfully processed acknowledgement IDs. + * + * Generated from protobuf field repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAckIds() + { + return $this->ack_ids; + } + + /** + * Optional. Successfully processed acknowledgement IDs. + * + * Generated from protobuf field repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAckIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->ack_ids = $arr; + + return $this; + } + + /** + * Optional. List of acknowledgement IDs that were malformed or whose + * acknowledgement deadline has expired. + * + * Generated from protobuf field repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInvalidAckIds() + { + return $this->invalid_ack_ids; + } + + /** + * Optional. List of acknowledgement IDs that were malformed or whose + * acknowledgement deadline has expired. + * + * Generated from protobuf field repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInvalidAckIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->invalid_ack_ids = $arr; + + return $this; + } + + /** + * Optional. List of acknowledgement IDs that failed processing with + * temporary issues. + * + * Generated from protobuf field repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTemporaryFailedAckIds() + { + return $this->temporary_failed_ack_ids; + } + + /** + * Optional. List of acknowledgement IDs that failed processing with + * temporary issues. + * + * Generated from protobuf field repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTemporaryFailedAckIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->temporary_failed_ack_ids = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ModifyAckDeadlineConfirmation::class, \Google\Cloud\PubSub\V1\StreamingPullResponse_ModifyAckDeadlineConfirmation::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/SubscriptionProperties.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/SubscriptionProperties.php new file mode 100644 index 000000000000..f531ca2a7d55 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/SubscriptionProperties.php @@ -0,0 +1,108 @@ +google.pubsub.v1.StreamingPullResponse.SubscriptionProperties + */ +class SubscriptionProperties extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. True iff exactly once delivery is enabled for this + * subscription. + * + * Generated from protobuf field bool exactly_once_delivery_enabled = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $exactly_once_delivery_enabled = false; + /** + * Optional. True iff message ordering is enabled for this subscription. + * + * Generated from protobuf field bool message_ordering_enabled = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $message_ordering_enabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $exactly_once_delivery_enabled + * Optional. True iff exactly once delivery is enabled for this + * subscription. + * @type bool $message_ordering_enabled + * Optional. True iff message ordering is enabled for this subscription. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Optional. True iff exactly once delivery is enabled for this + * subscription. + * + * Generated from protobuf field bool exactly_once_delivery_enabled = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getExactlyOnceDeliveryEnabled() + { + return $this->exactly_once_delivery_enabled; + } + + /** + * Optional. True iff exactly once delivery is enabled for this + * subscription. + * + * Generated from protobuf field bool exactly_once_delivery_enabled = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setExactlyOnceDeliveryEnabled($var) + { + GPBUtil::checkBool($var); + $this->exactly_once_delivery_enabled = $var; + + return $this; + } + + /** + * Optional. True iff message ordering is enabled for this subscription. + * + * Generated from protobuf field bool message_ordering_enabled = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getMessageOrderingEnabled() + { + return $this->message_ordering_enabled; + } + + /** + * Optional. True iff message ordering is enabled for this subscription. + * + * Generated from protobuf field bool message_ordering_enabled = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setMessageOrderingEnabled($var) + { + GPBUtil::checkBool($var); + $this->message_ordering_enabled = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SubscriptionProperties::class, \Google\Cloud\PubSub\V1\StreamingPullResponse_SubscriptionProperties::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription.php new file mode 100644 index 000000000000..349f59651b34 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription.php @@ -0,0 +1,1090 @@ +google.pubsub.v1.Subscription + */ +class Subscription extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the subscription. It must have the format + * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` 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"`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Required. The name of the topic from which this subscription is receiving + * messages. Format is `projects/{project}/topics/{topic}`. The value of this + * field will be `_deleted-topic_` if the topic has been deleted. + * + * Generated from protobuf field string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $topic = ''; + /** + * Optional. If push delivery is used with this subscription, this field is + * used to configure it. + * + * Generated from protobuf field .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $push_config = null; + /** + * Optional. If delivery to BigQuery is used with this subscription, this + * field is used to configure it. + * + * Generated from protobuf field .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $bigquery_config = null; + /** + * Optional. If delivery to Google Cloud Storage is used with this + * subscription, this field is used to configure it. + * + * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $cloud_storage_config = null; + /** + * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub + * waits for the subscriber to acknowledge receipt before resending the + * message. In the interval after the message is delivered and before it is + * acknowledged, it is considered to be _outstanding_. During that time + * period, the message will not be redelivered (on a best-effort basis). + * For pull subscriptions, this value is used as the initial value for the ack + * deadline. To override this value for a given message, call + * `ModifyAckDeadline` with the corresponding `ack_id` if using + * non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. + * The minimum custom deadline you can specify is 10 seconds. + * The maximum custom deadline you can specify is 600 seconds (10 minutes). + * If this parameter is 0, a default value of 10 seconds is used. + * For push delivery, this value is also used to set the request timeout for + * the call to the push endpoint. + * If the subscriber never acknowledges the message, the Pub/Sub + * system will eventually redeliver the message. + * + * Generated from protobuf field int32 ack_deadline_seconds = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ack_deadline_seconds = 0; + /** + * Optional. Indicates whether to retain acknowledged messages. If true, then + * messages are not expunged from the subscription's backlog, even if they are + * acknowledged, until they fall out of the `message_retention_duration` + * window. This must be true if you would like to [`Seek` to a timestamp] + * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in + * the past to replay previously-acknowledged messages. + * + * Generated from protobuf field bool retain_acked_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $retain_acked_messages = false; + /** + * Optional. How long to retain unacknowledged messages in the subscription's + * backlog, from the moment a message is published. If `retain_acked_messages` + * is true, then this also configures the retention of acknowledged messages, + * and thus configures how far back in time a `Seek` can be done. Defaults to + * 7 days. Cannot be more than 7 days or less than 10 minutes. + * + * Generated from protobuf field .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $message_retention_duration = null; + /** + * Optional. See [Creating and managing + * labels](https://cloud.google.com/pubsub/docs/labels). + * + * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Optional. If true, messages published with the same `ordering_key` in + * `PubsubMessage` will be delivered to the subscribers in the order in which + * they are received by the Pub/Sub system. Otherwise, they may be delivered + * in any order. + * + * Generated from protobuf field bool enable_message_ordering = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $enable_message_ordering = false; + /** + * Optional. A policy that specifies the conditions for this subscription's + * expiration. A subscription is considered active as long as any connected + * subscriber is successfully consuming messages from the subscription or is + * issuing operations on the subscription. If `expiration_policy` is not set, + * a *default policy* with `ttl` of 31 days will be used. The minimum allowed + * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set, + * but `expiration_policy.ttl` is not set, the subscription never expires. + * + * Generated from protobuf field .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $expiration_policy = null; + /** + * Optional. An expression written in the Pub/Sub [filter + * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, + * then only `PubsubMessage`s whose `attributes` field matches the filter are + * delivered on this subscription. If empty, then no messages are filtered + * out. + * + * Generated from protobuf field string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. A policy that specifies the conditions for dead lettering + * messages in this subscription. If dead_letter_policy is not set, dead + * lettering is disabled. + * The Pub/Sub service account associated with this subscriptions's + * parent project (i.e., + * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have + * permission to Acknowledge() messages on this subscription. + * + * Generated from protobuf field .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $dead_letter_policy = null; + /** + * Optional. A policy that specifies how Pub/Sub retries message delivery for + * this subscription. + * If not set, the default retry policy is applied. This generally implies + * that messages will be retried as soon as possible for healthy subscribers. + * RetryPolicy will be triggered on NACKs or acknowledgement deadline + * exceeded events for a given message. + * + * Generated from protobuf field .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $retry_policy = null; + /** + * Optional. Indicates whether the subscription is detached from its topic. + * Detached subscriptions don't receive messages from their topic and don't + * retain any backlog. `Pull` and `StreamingPull` requests will return + * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to + * the endpoint will not be made. + * + * Generated from protobuf field bool detached = 15 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $detached = false; + /** + * Optional. If true, Pub/Sub provides the following guarantees for the + * delivery of a message with a given value of `message_id` on this + * subscription: + * * The message sent to a subscriber is guaranteed not to be resent + * before the message's acknowledgement deadline expires. + * * An acknowledged message will not be resent to a subscriber. + * Note that subscribers may still receive multiple copies of a message + * when `enable_exactly_once_delivery` is true if the message was published + * multiple times by a publisher client. These copies are considered distinct + * by Pub/Sub and have distinct `message_id` values. + * + * Generated from protobuf field bool enable_exactly_once_delivery = 16 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $enable_exactly_once_delivery = false; + /** + * Output only. Indicates the minimum duration for which a message is retained + * after it is published to the subscription's topic. If this field is set, + * messages published to the subscription's topic in the last + * `topic_message_retention_duration` are always available to subscribers. See + * the `message_retention_duration` field in `Topic`. This field is set only + * in responses from the server; it is ignored if it is set in any requests. + * + * Generated from protobuf field .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $topic_message_retention_duration = null; + /** + * Output only. An output-only field indicating whether or not the + * subscription can receive messages. + * + * Generated from protobuf field .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + + /** + * @param string $name Required. The name of the subscription. It must have the format + * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` 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"`. + * @param string $topic Required. The name of the topic from which this subscription is receiving + * messages. Format is `projects/{project}/topics/{topic}`. The value of this + * field will be `_deleted-topic_` if the topic has been deleted. Please see + * {@see SubscriberClient::topicName()} for help formatting this field. + * @param \Google\Cloud\PubSub\V1\PushConfig $pushConfig Optional. If push delivery is used with this subscription, this field is + * used to configure it. + * @param int $ackDeadlineSeconds Optional. The approximate amount of time (on a best-effort basis) Pub/Sub + * waits for the subscriber to acknowledge receipt before resending the + * message. In the interval after the message is delivered and before it is + * acknowledged, it is considered to be _outstanding_. During that time + * period, the message will not be redelivered (on a best-effort basis). + * + * For pull subscriptions, this value is used as the initial value for the ack + * deadline. To override this value for a given message, call + * `ModifyAckDeadline` with the corresponding `ack_id` if using + * non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. + * The minimum custom deadline you can specify is 10 seconds. + * The maximum custom deadline you can specify is 600 seconds (10 minutes). + * If this parameter is 0, a default value of 10 seconds is used. + * + * For push delivery, this value is also used to set the request timeout for + * the call to the push endpoint. + * + * If the subscriber never acknowledges the message, the Pub/Sub + * system will eventually redeliver the message. + * + * @return \Google\Cloud\PubSub\V1\Subscription + * + * @experimental + */ + public static function build(string $name, string $topic, \Google\Cloud\PubSub\V1\PushConfig $pushConfig, int $ackDeadlineSeconds): self + { + return (new self()) + ->setName($name) + ->setTopic($topic) + ->setPushConfig($pushConfig) + ->setAckDeadlineSeconds($ackDeadlineSeconds); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the subscription. It must have the format + * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` 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"`. + * @type string $topic + * Required. The name of the topic from which this subscription is receiving + * messages. Format is `projects/{project}/topics/{topic}`. The value of this + * field will be `_deleted-topic_` if the topic has been deleted. + * @type \Google\Cloud\PubSub\V1\PushConfig $push_config + * Optional. If push delivery is used with this subscription, this field is + * used to configure it. + * @type \Google\Cloud\PubSub\V1\BigQueryConfig $bigquery_config + * Optional. If delivery to BigQuery is used with this subscription, this + * field is used to configure it. + * @type \Google\Cloud\PubSub\V1\CloudStorageConfig $cloud_storage_config + * Optional. If delivery to Google Cloud Storage is used with this + * subscription, this field is used to configure it. + * @type int $ack_deadline_seconds + * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub + * waits for the subscriber to acknowledge receipt before resending the + * message. In the interval after the message is delivered and before it is + * acknowledged, it is considered to be _outstanding_. During that time + * period, the message will not be redelivered (on a best-effort basis). + * For pull subscriptions, this value is used as the initial value for the ack + * deadline. To override this value for a given message, call + * `ModifyAckDeadline` with the corresponding `ack_id` if using + * non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. + * The minimum custom deadline you can specify is 10 seconds. + * The maximum custom deadline you can specify is 600 seconds (10 minutes). + * If this parameter is 0, a default value of 10 seconds is used. + * For push delivery, this value is also used to set the request timeout for + * the call to the push endpoint. + * If the subscriber never acknowledges the message, the Pub/Sub + * system will eventually redeliver the message. + * @type bool $retain_acked_messages + * Optional. Indicates whether to retain acknowledged messages. If true, then + * messages are not expunged from the subscription's backlog, even if they are + * acknowledged, until they fall out of the `message_retention_duration` + * window. This must be true if you would like to [`Seek` to a timestamp] + * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in + * the past to replay previously-acknowledged messages. + * @type \Google\Protobuf\Duration $message_retention_duration + * Optional. How long to retain unacknowledged messages in the subscription's + * backlog, from the moment a message is published. If `retain_acked_messages` + * is true, then this also configures the retention of acknowledged messages, + * and thus configures how far back in time a `Seek` can be done. Defaults to + * 7 days. Cannot be more than 7 days or less than 10 minutes. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. See [Creating and managing + * labels](https://cloud.google.com/pubsub/docs/labels). + * @type bool $enable_message_ordering + * Optional. If true, messages published with the same `ordering_key` in + * `PubsubMessage` will be delivered to the subscribers in the order in which + * they are received by the Pub/Sub system. Otherwise, they may be delivered + * in any order. + * @type \Google\Cloud\PubSub\V1\ExpirationPolicy $expiration_policy + * Optional. A policy that specifies the conditions for this subscription's + * expiration. A subscription is considered active as long as any connected + * subscriber is successfully consuming messages from the subscription or is + * issuing operations on the subscription. If `expiration_policy` is not set, + * a *default policy* with `ttl` of 31 days will be used. The minimum allowed + * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set, + * but `expiration_policy.ttl` is not set, the subscription never expires. + * @type string $filter + * Optional. An expression written in the Pub/Sub [filter + * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, + * then only `PubsubMessage`s whose `attributes` field matches the filter are + * delivered on this subscription. If empty, then no messages are filtered + * out. + * @type \Google\Cloud\PubSub\V1\DeadLetterPolicy $dead_letter_policy + * Optional. A policy that specifies the conditions for dead lettering + * messages in this subscription. If dead_letter_policy is not set, dead + * lettering is disabled. + * The Pub/Sub service account associated with this subscriptions's + * parent project (i.e., + * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have + * permission to Acknowledge() messages on this subscription. + * @type \Google\Cloud\PubSub\V1\RetryPolicy $retry_policy + * Optional. A policy that specifies how Pub/Sub retries message delivery for + * this subscription. + * If not set, the default retry policy is applied. This generally implies + * that messages will be retried as soon as possible for healthy subscribers. + * RetryPolicy will be triggered on NACKs or acknowledgement deadline + * exceeded events for a given message. + * @type bool $detached + * Optional. Indicates whether the subscription is detached from its topic. + * Detached subscriptions don't receive messages from their topic and don't + * retain any backlog. `Pull` and `StreamingPull` requests will return + * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to + * the endpoint will not be made. + * @type bool $enable_exactly_once_delivery + * Optional. If true, Pub/Sub provides the following guarantees for the + * delivery of a message with a given value of `message_id` on this + * subscription: + * * The message sent to a subscriber is guaranteed not to be resent + * before the message's acknowledgement deadline expires. + * * An acknowledged message will not be resent to a subscriber. + * Note that subscribers may still receive multiple copies of a message + * when `enable_exactly_once_delivery` is true if the message was published + * multiple times by a publisher client. These copies are considered distinct + * by Pub/Sub and have distinct `message_id` values. + * @type \Google\Protobuf\Duration $topic_message_retention_duration + * Output only. Indicates the minimum duration for which a message is retained + * after it is published to the subscription's topic. If this field is set, + * messages published to the subscription's topic in the last + * `topic_message_retention_duration` are always available to subscribers. See + * the `message_retention_duration` field in `Topic`. This field is set only + * in responses from the server; it is ignored if it is set in any requests. + * @type int $state + * Output only. An output-only field indicating whether or not the + * subscription can receive messages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the subscription. It must have the format + * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` 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"`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the subscription. It must have the format + * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` 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"`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The name of the topic from which this subscription is receiving + * messages. Format is `projects/{project}/topics/{topic}`. The value of this + * field will be `_deleted-topic_` if the topic has been deleted. + * + * Generated from protobuf field string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getTopic() + { + return $this->topic; + } + + /** + * Required. The name of the topic from which this subscription is receiving + * messages. Format is `projects/{project}/topics/{topic}`. The value of this + * field will be `_deleted-topic_` if the topic has been deleted. + * + * Generated from protobuf field string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTopic($var) + { + GPBUtil::checkString($var, True); + $this->topic = $var; + + return $this; + } + + /** + * Optional. If push delivery is used with this subscription, this field is + * used to configure it. + * + * Generated from protobuf field .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\PushConfig|null + */ + public function getPushConfig() + { + return $this->push_config; + } + + public function hasPushConfig() + { + return isset($this->push_config); + } + + public function clearPushConfig() + { + unset($this->push_config); + } + + /** + * Optional. If push delivery is used with this subscription, this field is + * used to configure it. + * + * Generated from protobuf field .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\PushConfig $var + * @return $this + */ + public function setPushConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PushConfig::class); + $this->push_config = $var; + + return $this; + } + + /** + * Optional. If delivery to BigQuery is used with this subscription, this + * field is used to configure it. + * + * Generated from protobuf field .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\BigQueryConfig|null + */ + public function getBigqueryConfig() + { + return $this->bigquery_config; + } + + public function hasBigqueryConfig() + { + return isset($this->bigquery_config); + } + + public function clearBigqueryConfig() + { + unset($this->bigquery_config); + } + + /** + * Optional. If delivery to BigQuery is used with this subscription, this + * field is used to configure it. + * + * Generated from protobuf field .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\BigQueryConfig $var + * @return $this + */ + public function setBigqueryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\BigQueryConfig::class); + $this->bigquery_config = $var; + + return $this; + } + + /** + * Optional. If delivery to Google Cloud Storage is used with this + * subscription, this field is used to configure it. + * + * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\CloudStorageConfig|null + */ + public function getCloudStorageConfig() + { + return $this->cloud_storage_config; + } + + public function hasCloudStorageConfig() + { + return isset($this->cloud_storage_config); + } + + public function clearCloudStorageConfig() + { + unset($this->cloud_storage_config); + } + + /** + * Optional. If delivery to Google Cloud Storage is used with this + * subscription, this field is used to configure it. + * + * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\CloudStorageConfig $var + * @return $this + */ + public function setCloudStorageConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\CloudStorageConfig::class); + $this->cloud_storage_config = $var; + + return $this; + } + + /** + * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub + * waits for the subscriber to acknowledge receipt before resending the + * message. In the interval after the message is delivered and before it is + * acknowledged, it is considered to be _outstanding_. During that time + * period, the message will not be redelivered (on a best-effort basis). + * For pull subscriptions, this value is used as the initial value for the ack + * deadline. To override this value for a given message, call + * `ModifyAckDeadline` with the corresponding `ack_id` if using + * non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. + * The minimum custom deadline you can specify is 10 seconds. + * The maximum custom deadline you can specify is 600 seconds (10 minutes). + * If this parameter is 0, a default value of 10 seconds is used. + * For push delivery, this value is also used to set the request timeout for + * the call to the push endpoint. + * If the subscriber never acknowledges the message, the Pub/Sub + * system will eventually redeliver the message. + * + * Generated from protobuf field int32 ack_deadline_seconds = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getAckDeadlineSeconds() + { + return $this->ack_deadline_seconds; + } + + /** + * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub + * waits for the subscriber to acknowledge receipt before resending the + * message. In the interval after the message is delivered and before it is + * acknowledged, it is considered to be _outstanding_. During that time + * period, the message will not be redelivered (on a best-effort basis). + * For pull subscriptions, this value is used as the initial value for the ack + * deadline. To override this value for a given message, call + * `ModifyAckDeadline` with the corresponding `ack_id` if using + * non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. + * The minimum custom deadline you can specify is 10 seconds. + * The maximum custom deadline you can specify is 600 seconds (10 minutes). + * If this parameter is 0, a default value of 10 seconds is used. + * For push delivery, this value is also used to set the request timeout for + * the call to the push endpoint. + * If the subscriber never acknowledges the message, the Pub/Sub + * system will eventually redeliver the message. + * + * Generated from protobuf field int32 ack_deadline_seconds = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setAckDeadlineSeconds($var) + { + GPBUtil::checkInt32($var); + $this->ack_deadline_seconds = $var; + + return $this; + } + + /** + * Optional. Indicates whether to retain acknowledged messages. If true, then + * messages are not expunged from the subscription's backlog, even if they are + * acknowledged, until they fall out of the `message_retention_duration` + * window. This must be true if you would like to [`Seek` to a timestamp] + * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in + * the past to replay previously-acknowledged messages. + * + * Generated from protobuf field bool retain_acked_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getRetainAckedMessages() + { + return $this->retain_acked_messages; + } + + /** + * Optional. Indicates whether to retain acknowledged messages. If true, then + * messages are not expunged from the subscription's backlog, even if they are + * acknowledged, until they fall out of the `message_retention_duration` + * window. This must be true if you would like to [`Seek` to a timestamp] + * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in + * the past to replay previously-acknowledged messages. + * + * Generated from protobuf field bool retain_acked_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setRetainAckedMessages($var) + { + GPBUtil::checkBool($var); + $this->retain_acked_messages = $var; + + return $this; + } + + /** + * Optional. How long to retain unacknowledged messages in the subscription's + * backlog, from the moment a message is published. If `retain_acked_messages` + * is true, then this also configures the retention of acknowledged messages, + * and thus configures how far back in time a `Seek` can be done. Defaults to + * 7 days. Cannot be more than 7 days or less than 10 minutes. + * + * Generated from protobuf field .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getMessageRetentionDuration() + { + return $this->message_retention_duration; + } + + public function hasMessageRetentionDuration() + { + return isset($this->message_retention_duration); + } + + public function clearMessageRetentionDuration() + { + unset($this->message_retention_duration); + } + + /** + * Optional. How long to retain unacknowledged messages in the subscription's + * backlog, from the moment a message is published. If `retain_acked_messages` + * is true, then this also configures the retention of acknowledged messages, + * and thus configures how far back in time a `Seek` can be done. Defaults to + * 7 days. Cannot be more than 7 days or less than 10 minutes. + * + * Generated from protobuf field .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMessageRetentionDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->message_retention_duration = $var; + + return $this; + } + + /** + * Optional. See [Creating and managing + * labels](https://cloud.google.com/pubsub/docs/labels). + * + * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. See [Creating and managing + * labels](https://cloud.google.com/pubsub/docs/labels). + * + * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Optional. If true, messages published with the same `ordering_key` in + * `PubsubMessage` will be delivered to the subscribers in the order in which + * they are received by the Pub/Sub system. Otherwise, they may be delivered + * in any order. + * + * Generated from protobuf field bool enable_message_ordering = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getEnableMessageOrdering() + { + return $this->enable_message_ordering; + } + + /** + * Optional. If true, messages published with the same `ordering_key` in + * `PubsubMessage` will be delivered to the subscribers in the order in which + * they are received by the Pub/Sub system. Otherwise, they may be delivered + * in any order. + * + * Generated from protobuf field bool enable_message_ordering = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setEnableMessageOrdering($var) + { + GPBUtil::checkBool($var); + $this->enable_message_ordering = $var; + + return $this; + } + + /** + * Optional. A policy that specifies the conditions for this subscription's + * expiration. A subscription is considered active as long as any connected + * subscriber is successfully consuming messages from the subscription or is + * issuing operations on the subscription. If `expiration_policy` is not set, + * a *default policy* with `ttl` of 31 days will be used. The minimum allowed + * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set, + * but `expiration_policy.ttl` is not set, the subscription never expires. + * + * Generated from protobuf field .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\ExpirationPolicy|null + */ + public function getExpirationPolicy() + { + return $this->expiration_policy; + } + + public function hasExpirationPolicy() + { + return isset($this->expiration_policy); + } + + public function clearExpirationPolicy() + { + unset($this->expiration_policy); + } + + /** + * Optional. A policy that specifies the conditions for this subscription's + * expiration. A subscription is considered active as long as any connected + * subscriber is successfully consuming messages from the subscription or is + * issuing operations on the subscription. If `expiration_policy` is not set, + * a *default policy* with `ttl` of 31 days will be used. The minimum allowed + * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set, + * but `expiration_policy.ttl` is not set, the subscription never expires. + * + * Generated from protobuf field .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\ExpirationPolicy $var + * @return $this + */ + public function setExpirationPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\ExpirationPolicy::class); + $this->expiration_policy = $var; + + return $this; + } + + /** + * Optional. An expression written in the Pub/Sub [filter + * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, + * then only `PubsubMessage`s whose `attributes` field matches the filter are + * delivered on this subscription. If empty, then no messages are filtered + * out. + * + * Generated from protobuf field string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. An expression written in the Pub/Sub [filter + * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, + * then only `PubsubMessage`s whose `attributes` field matches the filter are + * delivered on this subscription. If empty, then no messages are filtered + * out. + * + * Generated from protobuf field string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. A policy that specifies the conditions for dead lettering + * messages in this subscription. If dead_letter_policy is not set, dead + * lettering is disabled. + * The Pub/Sub service account associated with this subscriptions's + * parent project (i.e., + * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have + * permission to Acknowledge() messages on this subscription. + * + * Generated from protobuf field .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\DeadLetterPolicy|null + */ + public function getDeadLetterPolicy() + { + return $this->dead_letter_policy; + } + + public function hasDeadLetterPolicy() + { + return isset($this->dead_letter_policy); + } + + public function clearDeadLetterPolicy() + { + unset($this->dead_letter_policy); + } + + /** + * Optional. A policy that specifies the conditions for dead lettering + * messages in this subscription. If dead_letter_policy is not set, dead + * lettering is disabled. + * The Pub/Sub service account associated with this subscriptions's + * parent project (i.e., + * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have + * permission to Acknowledge() messages on this subscription. + * + * Generated from protobuf field .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\DeadLetterPolicy $var + * @return $this + */ + public function setDeadLetterPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\DeadLetterPolicy::class); + $this->dead_letter_policy = $var; + + return $this; + } + + /** + * Optional. A policy that specifies how Pub/Sub retries message delivery for + * this subscription. + * If not set, the default retry policy is applied. This generally implies + * that messages will be retried as soon as possible for healthy subscribers. + * RetryPolicy will be triggered on NACKs or acknowledgement deadline + * exceeded events for a given message. + * + * Generated from protobuf field .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\RetryPolicy|null + */ + public function getRetryPolicy() + { + return $this->retry_policy; + } + + public function hasRetryPolicy() + { + return isset($this->retry_policy); + } + + public function clearRetryPolicy() + { + unset($this->retry_policy); + } + + /** + * Optional. A policy that specifies how Pub/Sub retries message delivery for + * this subscription. + * If not set, the default retry policy is applied. This generally implies + * that messages will be retried as soon as possible for healthy subscribers. + * RetryPolicy will be triggered on NACKs or acknowledgement deadline + * exceeded events for a given message. + * + * Generated from protobuf field .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\RetryPolicy $var + * @return $this + */ + public function setRetryPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\RetryPolicy::class); + $this->retry_policy = $var; + + return $this; + } + + /** + * Optional. Indicates whether the subscription is detached from its topic. + * Detached subscriptions don't receive messages from their topic and don't + * retain any backlog. `Pull` and `StreamingPull` requests will return + * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to + * the endpoint will not be made. + * + * Generated from protobuf field bool detached = 15 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getDetached() + { + return $this->detached; + } + + /** + * Optional. Indicates whether the subscription is detached from its topic. + * Detached subscriptions don't receive messages from their topic and don't + * retain any backlog. `Pull` and `StreamingPull` requests will return + * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to + * the endpoint will not be made. + * + * Generated from protobuf field bool detached = 15 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setDetached($var) + { + GPBUtil::checkBool($var); + $this->detached = $var; + + return $this; + } + + /** + * Optional. If true, Pub/Sub provides the following guarantees for the + * delivery of a message with a given value of `message_id` on this + * subscription: + * * The message sent to a subscriber is guaranteed not to be resent + * before the message's acknowledgement deadline expires. + * * An acknowledged message will not be resent to a subscriber. + * Note that subscribers may still receive multiple copies of a message + * when `enable_exactly_once_delivery` is true if the message was published + * multiple times by a publisher client. These copies are considered distinct + * by Pub/Sub and have distinct `message_id` values. + * + * Generated from protobuf field bool enable_exactly_once_delivery = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getEnableExactlyOnceDelivery() + { + return $this->enable_exactly_once_delivery; + } + + /** + * Optional. If true, Pub/Sub provides the following guarantees for the + * delivery of a message with a given value of `message_id` on this + * subscription: + * * The message sent to a subscriber is guaranteed not to be resent + * before the message's acknowledgement deadline expires. + * * An acknowledged message will not be resent to a subscriber. + * Note that subscribers may still receive multiple copies of a message + * when `enable_exactly_once_delivery` is true if the message was published + * multiple times by a publisher client. These copies are considered distinct + * by Pub/Sub and have distinct `message_id` values. + * + * Generated from protobuf field bool enable_exactly_once_delivery = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setEnableExactlyOnceDelivery($var) + { + GPBUtil::checkBool($var); + $this->enable_exactly_once_delivery = $var; + + return $this; + } + + /** + * Output only. Indicates the minimum duration for which a message is retained + * after it is published to the subscription's topic. If this field is set, + * messages published to the subscription's topic in the last + * `topic_message_retention_duration` are always available to subscribers. See + * the `message_retention_duration` field in `Topic`. This field is set only + * in responses from the server; it is ignored if it is set in any requests. + * + * Generated from protobuf field .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Duration|null + */ + public function getTopicMessageRetentionDuration() + { + return $this->topic_message_retention_duration; + } + + public function hasTopicMessageRetentionDuration() + { + return isset($this->topic_message_retention_duration); + } + + public function clearTopicMessageRetentionDuration() + { + unset($this->topic_message_retention_duration); + } + + /** + * Output only. Indicates the minimum duration for which a message is retained + * after it is published to the subscription's topic. If this field is set, + * messages published to the subscription's topic in the last + * `topic_message_retention_duration` are always available to subscribers. See + * the `message_retention_duration` field in `Topic`. This field is set only + * in responses from the server; it is ignored if it is set in any requests. + * + * Generated from protobuf field .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTopicMessageRetentionDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->topic_message_retention_duration = $var; + + return $this; + } + + /** + * Output only. An output-only field indicating whether or not the + * subscription can receive messages. + * + * Generated from protobuf field .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. An output-only field indicating whether or not the + * subscription can receive messages. + * + * Generated from protobuf field .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\Subscription\State::class); + $this->state = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription/State.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription/State.php new file mode 100644 index 000000000000..9dd0c05877eb --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription/State.php @@ -0,0 +1,66 @@ +google.pubsub.v1.Subscription.State + */ +class State +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The subscription can actively receive messages + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The subscription cannot receive messages because of an error with the + * resource to which it pushes messages. See the more detailed error state + * in the corresponding configuration. + * + * Generated from protobuf enum RESOURCE_ERROR = 2; + */ + const RESOURCE_ERROR = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::RESOURCE_ERROR => 'RESOURCE_ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\PubSub\V1\Subscription_State::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic.php new file mode 100644 index 000000000000..aa0e5f0fca36 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic.php @@ -0,0 +1,473 @@ +google.pubsub.v1.Topic + */ +class Topic extends \Google\Protobuf\Internal\Message +{ + /** + * 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"`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Optional. See [Creating and managing labels] + * (https://cloud.google.com/pubsub/docs/labels). + * + * Generated from protobuf field map labels = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Optional. Policy constraining the set of Google Cloud Platform regions + * where messages published to the topic may be stored. If not present, then + * no constraints are in effect. + * + * Generated from protobuf field .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $message_storage_policy = null; + /** + * Optional. The resource name of the Cloud KMS CryptoKey to be used to + * protect access to messages published on this topic. + * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + * + * Generated from protobuf field string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $kms_key_name = ''; + /** + * Optional. Settings for validating messages published against a schema. + * + * Generated from protobuf field .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $schema_settings = null; + /** + * Optional. Reserved for future use. This field is set only in responses from + * the server; it is ignored if it is set in any requests. + * + * Generated from protobuf field bool satisfies_pzs = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $satisfies_pzs = false; + /** + * Optional. Indicates the minimum duration to retain a message after it is + * published to the topic. If this field is set, messages published to the + * topic in the last `message_retention_duration` are always available to + * subscribers. For instance, it allows any attached subscription to [seek to + * a + * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) + * that is up to `message_retention_duration` in the past. If this field is + * not set, message retention is controlled by settings on individual + * subscriptions. Cannot be more than 31 days or less than 10 minutes. + * + * Generated from protobuf field .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $message_retention_duration = null; + /** + * Output only. An output-only field indicating the state of the topic. + * + * Generated from protobuf field .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Optional. Settings for ingestion from a data source into this topic. + * + * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ingestion_data_source_settings = null; + + /** + * @param 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"`. + * + * @return \Google\Cloud\PubSub\V1\Topic + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type 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"`. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. See [Creating and managing labels] + * (https://cloud.google.com/pubsub/docs/labels). + * @type \Google\Cloud\PubSub\V1\MessageStoragePolicy $message_storage_policy + * Optional. Policy constraining the set of Google Cloud Platform regions + * where messages published to the topic may be stored. If not present, then + * no constraints are in effect. + * @type string $kms_key_name + * Optional. The resource name of the Cloud KMS CryptoKey to be used to + * protect access to messages published on this topic. + * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + * @type \Google\Cloud\PubSub\V1\SchemaSettings $schema_settings + * Optional. Settings for validating messages published against a schema. + * @type bool $satisfies_pzs + * Optional. Reserved for future use. This field is set only in responses from + * the server; it is ignored if it is set in any requests. + * @type \Google\Protobuf\Duration $message_retention_duration + * Optional. Indicates the minimum duration to retain a message after it is + * published to the topic. If this field is set, messages published to the + * topic in the last `message_retention_duration` are always available to + * subscribers. For instance, it allows any attached subscription to [seek to + * a + * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) + * that is up to `message_retention_duration` in the past. If this field is + * not set, message retention is controlled by settings on individual + * subscriptions. Cannot be more than 31 days or less than 10 minutes. + * @type int $state + * Output only. An output-only field indicating the state of the topic. + * @type \Google\Cloud\PubSub\V1\IngestionDataSourceSettings $ingestion_data_source_settings + * Optional. Settings for ingestion from a data source into this topic. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * 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"`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->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"`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. See [Creating and managing labels] + * (https://cloud.google.com/pubsub/docs/labels). + * + * Generated from protobuf field map labels = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. See [Creating and managing labels] + * (https://cloud.google.com/pubsub/docs/labels). + * + * Generated from protobuf field map labels = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Optional. Policy constraining the set of Google Cloud Platform regions + * where messages published to the topic may be stored. If not present, then + * no constraints are in effect. + * + * Generated from protobuf field .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\MessageStoragePolicy|null + */ + public function getMessageStoragePolicy() + { + return $this->message_storage_policy; + } + + public function hasMessageStoragePolicy() + { + return isset($this->message_storage_policy); + } + + public function clearMessageStoragePolicy() + { + unset($this->message_storage_policy); + } + + /** + * Optional. Policy constraining the set of Google Cloud Platform regions + * where messages published to the topic may be stored. If not present, then + * no constraints are in effect. + * + * Generated from protobuf field .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\MessageStoragePolicy $var + * @return $this + */ + public function setMessageStoragePolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\MessageStoragePolicy::class); + $this->message_storage_policy = $var; + + return $this; + } + + /** + * Optional. The resource name of the Cloud KMS CryptoKey to be used to + * protect access to messages published on this topic. + * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + * + * Generated from protobuf field string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * Optional. The resource name of the Cloud KMS CryptoKey to be used to + * protect access to messages published on this topic. + * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + * + * Generated from protobuf field string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + + /** + * Optional. Settings for validating messages published against a schema. + * + * Generated from protobuf field .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\SchemaSettings|null + */ + public function getSchemaSettings() + { + return $this->schema_settings; + } + + public function hasSchemaSettings() + { + return isset($this->schema_settings); + } + + public function clearSchemaSettings() + { + unset($this->schema_settings); + } + + /** + * Optional. Settings for validating messages published against a schema. + * + * Generated from protobuf field .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\SchemaSettings $var + * @return $this + */ + public function setSchemaSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\SchemaSettings::class); + $this->schema_settings = $var; + + return $this; + } + + /** + * Optional. Reserved for future use. This field is set only in responses from + * the server; it is ignored if it is set in any requests. + * + * Generated from protobuf field bool satisfies_pzs = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getSatisfiesPzs() + { + return $this->satisfies_pzs; + } + + /** + * Optional. Reserved for future use. This field is set only in responses from + * the server; it is ignored if it is set in any requests. + * + * Generated from protobuf field bool satisfies_pzs = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setSatisfiesPzs($var) + { + GPBUtil::checkBool($var); + $this->satisfies_pzs = $var; + + return $this; + } + + /** + * Optional. Indicates the minimum duration to retain a message after it is + * published to the topic. If this field is set, messages published to the + * topic in the last `message_retention_duration` are always available to + * subscribers. For instance, it allows any attached subscription to [seek to + * a + * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) + * that is up to `message_retention_duration` in the past. If this field is + * not set, message retention is controlled by settings on individual + * subscriptions. Cannot be more than 31 days or less than 10 minutes. + * + * Generated from protobuf field .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getMessageRetentionDuration() + { + return $this->message_retention_duration; + } + + public function hasMessageRetentionDuration() + { + return isset($this->message_retention_duration); + } + + public function clearMessageRetentionDuration() + { + unset($this->message_retention_duration); + } + + /** + * Optional. Indicates the minimum duration to retain a message after it is + * published to the topic. If this field is set, messages published to the + * topic in the last `message_retention_duration` are always available to + * subscribers. For instance, it allows any attached subscription to [seek to + * a + * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) + * that is up to `message_retention_duration` in the past. If this field is + * not set, message retention is controlled by settings on individual + * subscriptions. Cannot be more than 31 days or less than 10 minutes. + * + * Generated from protobuf field .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMessageRetentionDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->message_retention_duration = $var; + + return $this; + } + + /** + * Output only. An output-only field indicating the state of the topic. + * + * Generated from protobuf field .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. An output-only field indicating the state of the topic. + * + * Generated from protobuf field .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\Topic\State::class); + $this->state = $var; + + return $this; + } + + /** + * Optional. Settings for ingestion from a data source into this topic. + * + * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\PubSub\V1\IngestionDataSourceSettings|null + */ + public function getIngestionDataSourceSettings() + { + return $this->ingestion_data_source_settings; + } + + public function hasIngestionDataSourceSettings() + { + return isset($this->ingestion_data_source_settings); + } + + public function clearIngestionDataSourceSettings() + { + unset($this->ingestion_data_source_settings); + } + + /** + * Optional. Settings for ingestion from a data source into this topic. + * + * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\PubSub\V1\IngestionDataSourceSettings $var + * @return $this + */ + public function setIngestionDataSourceSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\IngestionDataSourceSettings::class); + $this->ingestion_data_source_settings = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic/State.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic/State.php new file mode 100644 index 000000000000..ca6a253e6503 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic/State.php @@ -0,0 +1,66 @@ +google.pubsub.v1.Topic.State + */ +class State +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The topic does not have any persistent errors. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Ingestion from the data source has encountered a permanent error. + * See the more detailed error state in the corresponding ingestion + * source configuration. + * + * Generated from protobuf enum INGESTION_RESOURCE_ERROR = 2; + */ + const INGESTION_RESOURCE_ERROR = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::INGESTION_RESOURCE_ERROR => 'INGESTION_RESOURCE_ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\PubSub\V1\Topic_State::class); + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSnapshotRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSnapshotRequest.php new file mode 100644 index 000000000000..aa2378043b3f --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSnapshotRequest.php @@ -0,0 +1,141 @@ +google.pubsub.v1.UpdateSnapshotRequest + */ +class UpdateSnapshotRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The updated snapshot object. + * + * Generated from protobuf field .google.pubsub.v1.Snapshot snapshot = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $snapshot = null; + /** + * Required. Indicates which fields in the provided snapshot to update. + * Must be specified and non-empty. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\PubSub\V1\Snapshot $snapshot Required. The updated snapshot object. + * @param \Google\Protobuf\FieldMask $updateMask Required. Indicates which fields in the provided snapshot to update. + * Must be specified and non-empty. + * + * @return \Google\Cloud\PubSub\V1\UpdateSnapshotRequest + * + * @experimental + */ + public static function build(\Google\Cloud\PubSub\V1\Snapshot $snapshot, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setSnapshot($snapshot) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\PubSub\V1\Snapshot $snapshot + * Required. The updated snapshot object. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Indicates which fields in the provided snapshot to update. + * Must be specified and non-empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The updated snapshot object. + * + * Generated from protobuf field .google.pubsub.v1.Snapshot snapshot = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\PubSub\V1\Snapshot|null + */ + public function getSnapshot() + { + return $this->snapshot; + } + + public function hasSnapshot() + { + return isset($this->snapshot); + } + + public function clearSnapshot() + { + unset($this->snapshot); + } + + /** + * Required. The updated snapshot object. + * + * Generated from protobuf field .google.pubsub.v1.Snapshot snapshot = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\PubSub\V1\Snapshot $var + * @return $this + */ + public function setSnapshot($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Snapshot::class); + $this->snapshot = $var; + + return $this; + } + + /** + * Required. Indicates which fields in the provided snapshot to update. + * Must be specified and non-empty. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Indicates which fields in the provided snapshot to update. + * Must be specified and non-empty. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSubscriptionRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSubscriptionRequest.php new file mode 100644 index 000000000000..d64008746353 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSubscriptionRequest.php @@ -0,0 +1,141 @@ +google.pubsub.v1.UpdateSubscriptionRequest + */ +class UpdateSubscriptionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The updated subscription object. + * + * Generated from protobuf field .google.pubsub.v1.Subscription subscription = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $subscription = null; + /** + * Required. Indicates which fields in the provided subscription to update. + * Must be specified and non-empty. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\PubSub\V1\Subscription $subscription Required. The updated subscription object. + * @param \Google\Protobuf\FieldMask $updateMask Required. Indicates which fields in the provided subscription to update. + * Must be specified and non-empty. + * + * @return \Google\Cloud\PubSub\V1\UpdateSubscriptionRequest + * + * @experimental + */ + public static function build(\Google\Cloud\PubSub\V1\Subscription $subscription, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setSubscription($subscription) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\PubSub\V1\Subscription $subscription + * Required. The updated subscription object. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Indicates which fields in the provided subscription to update. + * Must be specified and non-empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The updated subscription object. + * + * Generated from protobuf field .google.pubsub.v1.Subscription subscription = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\PubSub\V1\Subscription|null + */ + public function getSubscription() + { + return $this->subscription; + } + + public function hasSubscription() + { + return isset($this->subscription); + } + + public function clearSubscription() + { + unset($this->subscription); + } + + /** + * Required. The updated subscription object. + * + * Generated from protobuf field .google.pubsub.v1.Subscription subscription = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\PubSub\V1\Subscription $var + * @return $this + */ + public function setSubscription($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Subscription::class); + $this->subscription = $var; + + return $this; + } + + /** + * Required. Indicates which fields in the provided subscription to update. + * Must be specified and non-empty. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Indicates which fields in the provided subscription to update. + * Must be specified and non-empty. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateTopicRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateTopicRequest.php new file mode 100644 index 000000000000..1a09ea4292aa --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateTopicRequest.php @@ -0,0 +1,156 @@ +google.pubsub.v1.UpdateTopicRequest + */ +class UpdateTopicRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The updated topic object. + * + * Generated from protobuf field .google.pubsub.v1.Topic topic = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $topic = null; + /** + * Required. Indicates which fields in the provided topic to update. Must be + * specified and non-empty. Note that if `update_mask` contains + * "message_storage_policy" but the `message_storage_policy` is not set in + * the `topic` provided above, then the updated value is determined by the + * policy configured at the project or organization level. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\PubSub\V1\Topic $topic Required. The updated topic object. + * @param \Google\Protobuf\FieldMask $updateMask Required. Indicates which fields in the provided topic to update. Must be + * specified and non-empty. Note that if `update_mask` contains + * "message_storage_policy" but the `message_storage_policy` is not set in + * the `topic` provided above, then the updated value is determined by the + * policy configured at the project or organization level. + * + * @return \Google\Cloud\PubSub\V1\UpdateTopicRequest + * + * @experimental + */ + public static function build(\Google\Cloud\PubSub\V1\Topic $topic, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setTopic($topic) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\PubSub\V1\Topic $topic + * Required. The updated topic object. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Indicates which fields in the provided topic to update. Must be + * specified and non-empty. Note that if `update_mask` contains + * "message_storage_policy" but the `message_storage_policy` is not set in + * the `topic` provided above, then the updated value is determined by the + * policy configured at the project or organization level. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); + parent::__construct($data); + } + + /** + * Required. The updated topic object. + * + * Generated from protobuf field .google.pubsub.v1.Topic topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\PubSub\V1\Topic|null + */ + public function getTopic() + { + return $this->topic; + } + + public function hasTopic() + { + return isset($this->topic); + } + + public function clearTopic() + { + unset($this->topic); + } + + /** + * Required. The updated topic object. + * + * Generated from protobuf field .google.pubsub.v1.Topic topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\PubSub\V1\Topic $var + * @return $this + */ + public function setTopic($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Topic::class); + $this->topic = $var; + + return $this; + } + + /** + * Required. Indicates which fields in the provided topic to update. Must be + * specified and non-empty. Note that if `update_mask` contains + * "message_storage_policy" but the `message_storage_policy` is not set in + * the `topic` provided above, then the updated value is determined by the + * policy configured at the project or organization level. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Indicates which fields in the provided topic to update. Must be + * specified and non-empty. Note that if `update_mask` contains + * "message_storage_policy" but the `message_storage_policy` is not set in + * the `topic` provided above, then the updated value is determined by the + * policy configured at the project or organization level. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageRequest.php new file mode 100644 index 000000000000..cc85b3a7abd4 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageRequest.php @@ -0,0 +1,217 @@ +google.pubsub.v1.ValidateMessageRequest + */ +class ValidateMessageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project in which to validate schemas. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Message to validate against the provided `schema_spec`. + * + * Generated from protobuf field bytes message = 4; + */ + protected $message = ''; + /** + * The encoding expected for messages + * + * Generated from protobuf field .google.pubsub.v1.Encoding encoding = 5; + */ + protected $encoding = 0; + protected $schema_spec; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the project in which to validate schemas. + * Format is `projects/{project-id}`. + * @type string $name + * Name of the schema against which to validate. + * Format is `projects/{project}/schemas/{schema}`. + * @type \Google\Cloud\PubSub\V1\Schema $schema + * Ad-hoc schema against which to validate + * @type string $message + * Message to validate against the provided `schema_spec`. + * @type int $encoding + * The encoding expected for messages + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project in which to validate schemas. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the project in which to validate schemas. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Name of the schema against which to validate. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->readOneof(2); + } + + public function hasName() + { + return $this->hasOneof(2); + } + + /** + * Name of the schema against which to validate. + * Format is `projects/{project}/schemas/{schema}`. + * + * Generated from protobuf field string name = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Ad-hoc schema against which to validate + * + * Generated from protobuf field .google.pubsub.v1.Schema schema = 3; + * @return \Google\Cloud\PubSub\V1\Schema|null + */ + public function getSchema() + { + return $this->readOneof(3); + } + + public function hasSchema() + { + return $this->hasOneof(3); + } + + /** + * Ad-hoc schema against which to validate + * + * Generated from protobuf field .google.pubsub.v1.Schema schema = 3; + * @param \Google\Cloud\PubSub\V1\Schema $var + * @return $this + */ + public function setSchema($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Schema::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Message to validate against the provided `schema_spec`. + * + * Generated from protobuf field bytes message = 4; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Message to validate against the provided `schema_spec`. + * + * Generated from protobuf field bytes message = 4; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, False); + $this->message = $var; + + return $this; + } + + /** + * The encoding expected for messages + * + * Generated from protobuf field .google.pubsub.v1.Encoding encoding = 5; + * @return int + */ + public function getEncoding() + { + return $this->encoding; + } + + /** + * The encoding expected for messages + * + * Generated from protobuf field .google.pubsub.v1.Encoding encoding = 5; + * @param int $var + * @return $this + */ + public function setEncoding($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\Encoding::class); + $this->encoding = $var; + + return $this; + } + + /** + * @return string + */ + public function getSchemaSpec() + { + return $this->whichOneof("schema_spec"); + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageResponse.php new file mode 100644 index 000000000000..3447bdcc8e1d --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageResponse.php @@ -0,0 +1,34 @@ +google.pubsub.v1.ValidateMessageResponse + */ +class ValidateMessageResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaRequest.php new file mode 100644 index 000000000000..25fd4f172a70 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaRequest.php @@ -0,0 +1,132 @@ +google.pubsub.v1.ValidateSchemaRequest + */ +class ValidateSchemaRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project in which to validate schemas. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The schema object to validate. + * + * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $schema = null; + + /** + * @param string $parent Required. The name of the project in which to validate schemas. + * Format is `projects/{project-id}`. Please see + * {@see SchemaServiceClient::projectName()} for help formatting this field. + * @param \Google\Cloud\PubSub\V1\Schema $schema Required. The schema object to validate. + * + * @return \Google\Cloud\PubSub\V1\ValidateSchemaRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\PubSub\V1\Schema $schema): self + { + return (new self()) + ->setParent($parent) + ->setSchema($schema); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the project in which to validate schemas. + * Format is `projects/{project-id}`. + * @type \Google\Cloud\PubSub\V1\Schema $schema + * Required. The schema object to validate. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project in which to validate schemas. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the project in which to validate schemas. + * Format is `projects/{project-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The schema object to validate. + * + * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\PubSub\V1\Schema|null + */ + public function getSchema() + { + return $this->schema; + } + + public function hasSchema() + { + return isset($this->schema); + } + + public function clearSchema() + { + unset($this->schema); + } + + /** + * Required. The schema object to validate. + * + * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\PubSub\V1\Schema $var + * @return $this + */ + public function setSchema($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Schema::class); + $this->schema = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaResponse.php new file mode 100644 index 000000000000..777511b5f987 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaResponse.php @@ -0,0 +1,34 @@ +google.pubsub.v1.ValidateSchemaResponse + */ +class ValidateSchemaResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/create_topic.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/create_topic.php new file mode 100644 index 000000000000..316f4cb7a671 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/create_topic.php @@ -0,0 +1,75 @@ +setName($name); + + // Call the API and handle any network failures. + try { + /** @var Topic $response */ + $response = $publisherClient->createTopic($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + + create_topic_sample($name); +} +// [END pubsub_v1_generated_Publisher_CreateTopic_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/delete_topic.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/delete_topic.php new file mode 100644 index 000000000000..128ab5472a75 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/delete_topic.php @@ -0,0 +1,74 @@ +setTopic($formattedTopic); + + // Call the API and handle any network failures. + try { + $publisherClient->deleteTopic($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedTopic = PublisherClient::topicName('[PROJECT]', '[TOPIC]'); + + delete_topic_sample($formattedTopic); +} +// [END pubsub_v1_generated_Publisher_DeleteTopic_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/detach_subscription.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/detach_subscription.php new file mode 100644 index 000000000000..4c1c766c4bce --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/detach_subscription.php @@ -0,0 +1,75 @@ +setSubscription($formattedSubscription); + + // Call the API and handle any network failures. + try { + /** @var DetachSubscriptionResponse $response */ + $response = $publisherClient->detachSubscription($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSubscription = PublisherClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + + detach_subscription_sample($formattedSubscription); +} +// [END pubsub_v1_generated_Publisher_DetachSubscription_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_iam_policy.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_iam_policy.php new file mode 100644 index 000000000000..54e97ffbd1c7 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_iam_policy.php @@ -0,0 +1,72 @@ +setResource($resource); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $publisherClient->getIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END pubsub_v1_generated_Publisher_GetIamPolicy_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_topic.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_topic.php new file mode 100644 index 000000000000..5b08a9beef4c --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_topic.php @@ -0,0 +1,72 @@ +setTopic($formattedTopic); + + // Call the API and handle any network failures. + try { + /** @var Topic $response */ + $response = $publisherClient->getTopic($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedTopic = PublisherClient::topicName('[PROJECT]', '[TOPIC]'); + + get_topic_sample($formattedTopic); +} +// [END pubsub_v1_generated_Publisher_GetTopic_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_snapshots.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_snapshots.php new file mode 100644 index 000000000000..640c0a2f75af --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_snapshots.php @@ -0,0 +1,80 @@ +setTopic($formattedTopic); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $publisherClient->listTopicSnapshots($request); + + /** @var string $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedTopic = PublisherClient::topicName('[PROJECT]', '[TOPIC]'); + + list_topic_snapshots_sample($formattedTopic); +} +// [END pubsub_v1_generated_Publisher_ListTopicSnapshots_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_subscriptions.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_subscriptions.php new file mode 100644 index 000000000000..4c808e9a7ca8 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_subscriptions.php @@ -0,0 +1,76 @@ +setTopic($formattedTopic); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $publisherClient->listTopicSubscriptions($request); + + /** @var string $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedTopic = PublisherClient::topicName('[PROJECT]', '[TOPIC]'); + + list_topic_subscriptions_sample($formattedTopic); +} +// [END pubsub_v1_generated_Publisher_ListTopicSubscriptions_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topics.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topics.php new file mode 100644 index 000000000000..84f7989720d5 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topics.php @@ -0,0 +1,77 @@ +setProject($formattedProject); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $publisherClient->listTopics($request); + + /** @var Topic $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedProject = PublisherClient::projectName('[PROJECT]'); + + list_topics_sample($formattedProject); +} +// [END pubsub_v1_generated_Publisher_ListTopics_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/publish.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/publish.php new file mode 100644 index 000000000000..c58244cd9965 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/publish.php @@ -0,0 +1,76 @@ +setTopic($formattedTopic) + ->setMessages($messages); + + // Call the API and handle any network failures. + try { + /** @var PublishResponse $response */ + $response = $publisherClient->publish($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedTopic = PublisherClient::topicName('[PROJECT]', '[TOPIC]'); + + publish_sample($formattedTopic); +} +// [END pubsub_v1_generated_Publisher_Publish_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/set_iam_policy.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/set_iam_policy.php new file mode 100644 index 000000000000..a5dc7d4bf3e1 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/set_iam_policy.php @@ -0,0 +1,77 @@ +setResource($resource) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $publisherClient->setIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END pubsub_v1_generated_Publisher_SetIamPolicy_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/test_iam_permissions.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/test_iam_permissions.php new file mode 100644 index 000000000000..42eb4aacb66d --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/test_iam_permissions.php @@ -0,0 +1,84 @@ +setResource($resource) + ->setPermissions($permissions); + + // Call the API and handle any network failures. + try { + /** @var TestIamPermissionsResponse $response */ + $response = $publisherClient->testIamPermissions($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END pubsub_v1_generated_Publisher_TestIamPermissions_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/update_topic.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/update_topic.php new file mode 100644 index 000000000000..2685411cef6c --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/update_topic.php @@ -0,0 +1,81 @@ +setName($topicName); + $updateMask = new FieldMask(); + $request = (new UpdateTopicRequest()) + ->setTopic($topic) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var Topic $response */ + $response = $publisherClient->updateTopic($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $topicName = '[NAME]'; + + update_topic_sample($topicName); +} +// [END pubsub_v1_generated_Publisher_UpdateTopic_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/commit_schema.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/commit_schema.php new file mode 100644 index 000000000000..de8d6bd5fe4c --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/commit_schema.php @@ -0,0 +1,78 @@ +setName($schemaName); + $request = (new CommitSchemaRequest()) + ->setName($formattedName) + ->setSchema($schema); + + // Call the API and handle any network failures. + try { + /** @var Schema $response */ + $response = $schemaServiceClient->commitSchema($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SchemaServiceClient::schemaName('[PROJECT]', '[SCHEMA]'); + $schemaName = '[NAME]'; + + commit_schema_sample($formattedName, $schemaName); +} +// [END pubsub_v1_generated_SchemaService_CommitSchema_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/create_schema.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/create_schema.php new file mode 100644 index 000000000000..3daea89e0902 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/create_schema.php @@ -0,0 +1,78 @@ +setName($schemaName); + $request = (new CreateSchemaRequest()) + ->setParent($formattedParent) + ->setSchema($schema); + + // Call the API and handle any network failures. + try { + /** @var Schema $response */ + $response = $schemaServiceClient->createSchema($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = SchemaServiceClient::projectName('[PROJECT]'); + $schemaName = '[NAME]'; + + create_schema_sample($formattedParent, $schemaName); +} +// [END pubsub_v1_generated_SchemaService_CreateSchema_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema.php new file mode 100644 index 000000000000..5ffc378dba80 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema.php @@ -0,0 +1,70 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $schemaServiceClient->deleteSchema($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SchemaServiceClient::schemaName('[PROJECT]', '[SCHEMA]'); + + delete_schema_sample($formattedName); +} +// [END pubsub_v1_generated_SchemaService_DeleteSchema_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema_revision.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema_revision.php new file mode 100644 index 000000000000..86c02a211275 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema_revision.php @@ -0,0 +1,79 @@ +setName($formattedName) + ->setRevisionId($revisionId); + + // Call the API and handle any network failures. + try { + /** @var Schema $response */ + $response = $schemaServiceClient->deleteSchemaRevision($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SchemaServiceClient::schemaName('[PROJECT]', '[SCHEMA]'); + $revisionId = '[REVISION_ID]'; + + delete_schema_revision_sample($formattedName, $revisionId); +} +// [END pubsub_v1_generated_SchemaService_DeleteSchemaRevision_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_iam_policy.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_iam_policy.php new file mode 100644 index 000000000000..64bf89b99ec3 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_iam_policy.php @@ -0,0 +1,72 @@ +setResource($resource); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $schemaServiceClient->getIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END pubsub_v1_generated_SchemaService_GetIamPolicy_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_schema.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_schema.php new file mode 100644 index 000000000000..bcff150482ee --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_schema.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Schema $response */ + $response = $schemaServiceClient->getSchema($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SchemaServiceClient::schemaName('[PROJECT]', '[SCHEMA]'); + + get_schema_sample($formattedName); +} +// [END pubsub_v1_generated_SchemaService_GetSchema_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schema_revisions.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schema_revisions.php new file mode 100644 index 000000000000..f2c3c2eec7ed --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schema_revisions.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $schemaServiceClient->listSchemaRevisions($request); + + /** @var Schema $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SchemaServiceClient::schemaName('[PROJECT]', '[SCHEMA]'); + + list_schema_revisions_sample($formattedName); +} +// [END pubsub_v1_generated_SchemaService_ListSchemaRevisions_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schemas.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schemas.php new file mode 100644 index 000000000000..530a62b93920 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schemas.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $schemaServiceClient->listSchemas($request); + + /** @var Schema $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = SchemaServiceClient::projectName('[PROJECT]'); + + list_schemas_sample($formattedParent); +} +// [END pubsub_v1_generated_SchemaService_ListSchemas_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/rollback_schema.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/rollback_schema.php new file mode 100644 index 000000000000..7fb67a43d5c4 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/rollback_schema.php @@ -0,0 +1,77 @@ +setName($formattedName) + ->setRevisionId($revisionId); + + // Call the API and handle any network failures. + try { + /** @var Schema $response */ + $response = $schemaServiceClient->rollbackSchema($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SchemaServiceClient::schemaName('[PROJECT]', '[SCHEMA]'); + $revisionId = '[REVISION_ID]'; + + rollback_schema_sample($formattedName, $revisionId); +} +// [END pubsub_v1_generated_SchemaService_RollbackSchema_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/set_iam_policy.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/set_iam_policy.php new file mode 100644 index 000000000000..330633f3b164 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/set_iam_policy.php @@ -0,0 +1,77 @@ +setResource($resource) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $schemaServiceClient->setIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END pubsub_v1_generated_SchemaService_SetIamPolicy_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/test_iam_permissions.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/test_iam_permissions.php new file mode 100644 index 000000000000..6adbcab9c434 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/test_iam_permissions.php @@ -0,0 +1,84 @@ +setResource($resource) + ->setPermissions($permissions); + + // Call the API and handle any network failures. + try { + /** @var TestIamPermissionsResponse $response */ + $response = $schemaServiceClient->testIamPermissions($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END pubsub_v1_generated_SchemaService_TestIamPermissions_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_message.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_message.php new file mode 100644 index 000000000000..276757f26738 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_message.php @@ -0,0 +1,72 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var ValidateMessageResponse $response */ + $response = $schemaServiceClient->validateMessage($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = SchemaServiceClient::projectName('[PROJECT]'); + + validate_message_sample($formattedParent); +} +// [END pubsub_v1_generated_SchemaService_ValidateMessage_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_schema.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_schema.php new file mode 100644 index 000000000000..fc186436fb96 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_schema.php @@ -0,0 +1,79 @@ +setName($schemaName); + $request = (new ValidateSchemaRequest()) + ->setParent($formattedParent) + ->setSchema($schema); + + // Call the API and handle any network failures. + try { + /** @var ValidateSchemaResponse $response */ + $response = $schemaServiceClient->validateSchema($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = SchemaServiceClient::projectName('[PROJECT]'); + $schemaName = '[NAME]'; + + validate_schema_sample($formattedParent, $schemaName); +} +// [END pubsub_v1_generated_SchemaService_ValidateSchema_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/acknowledge.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/acknowledge.php new file mode 100644 index 000000000000..c06acebd45c0 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/acknowledge.php @@ -0,0 +1,82 @@ +setSubscription($formattedSubscription) + ->setAckIds($ackIds); + + // Call the API and handle any network failures. + try { + $subscriberClient->acknowledge($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $ackIdsElement = '[ACK_IDS]'; + + acknowledge_sample($formattedSubscription, $ackIdsElement); +} +// [END pubsub_v1_generated_Subscriber_Acknowledge_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_snapshot.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_snapshot.php new file mode 100644 index 000000000000..1616d96fe49d --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_snapshot.php @@ -0,0 +1,103 @@ +setName($formattedName) + ->setSubscription($formattedSubscription); + + // Call the API and handle any network failures. + try { + /** @var Snapshot $response */ + $response = $subscriberClient->createSnapshot($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SubscriberClient::snapshotName('[PROJECT]', '[SNAPSHOT]'); + $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + + create_snapshot_sample($formattedName, $formattedSubscription); +} +// [END pubsub_v1_generated_Subscriber_CreateSnapshot_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_subscription.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_subscription.php new file mode 100644 index 000000000000..3d740e589e8d --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_subscription.php @@ -0,0 +1,90 @@ +setName($name) + ->setTopic($formattedTopic); + + // Call the API and handle any network failures. + try { + /** @var Subscription $response */ + $response = $subscriberClient->createSubscription($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + $formattedTopic = SubscriberClient::topicName('[PROJECT]', '[TOPIC]'); + + create_subscription_sample($name, $formattedTopic); +} +// [END pubsub_v1_generated_Subscriber_CreateSubscription_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_snapshot.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_snapshot.php new file mode 100644 index 000000000000..e76cd30d0f1e --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_snapshot.php @@ -0,0 +1,78 @@ +setSnapshot($formattedSnapshot); + + // Call the API and handle any network failures. + try { + $subscriberClient->deleteSnapshot($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSnapshot = SubscriberClient::snapshotName('[PROJECT]', '[SNAPSHOT]'); + + delete_snapshot_sample($formattedSnapshot); +} +// [END pubsub_v1_generated_Subscriber_DeleteSnapshot_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_subscription.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_subscription.php new file mode 100644 index 000000000000..052c67f9c8b2 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_subscription.php @@ -0,0 +1,74 @@ +setSubscription($formattedSubscription); + + // Call the API and handle any network failures. + try { + $subscriberClient->deleteSubscription($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + + delete_subscription_sample($formattedSubscription); +} +// [END pubsub_v1_generated_Subscriber_DeleteSubscription_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_iam_policy.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_iam_policy.php new file mode 100644 index 000000000000..8e003f43b71b --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_iam_policy.php @@ -0,0 +1,72 @@ +setResource($resource); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $subscriberClient->getIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END pubsub_v1_generated_Subscriber_GetIamPolicy_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_snapshot.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_snapshot.php new file mode 100644 index 000000000000..8b2da513c2ba --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_snapshot.php @@ -0,0 +1,76 @@ +setSnapshot($formattedSnapshot); + + // Call the API and handle any network failures. + try { + /** @var Snapshot $response */ + $response = $subscriberClient->getSnapshot($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSnapshot = SubscriberClient::snapshotName('[PROJECT]', '[SNAPSHOT]'); + + get_snapshot_sample($formattedSnapshot); +} +// [END pubsub_v1_generated_Subscriber_GetSnapshot_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_subscription.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_subscription.php new file mode 100644 index 000000000000..63d0dcfdf6a3 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_subscription.php @@ -0,0 +1,72 @@ +setSubscription($formattedSubscription); + + // Call the API and handle any network failures. + try { + /** @var Subscription $response */ + $response = $subscriberClient->getSubscription($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + + get_subscription_sample($formattedSubscription); +} +// [END pubsub_v1_generated_Subscriber_GetSubscription_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_snapshots.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_snapshots.php new file mode 100644 index 000000000000..781a23c3e60a --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_snapshots.php @@ -0,0 +1,81 @@ +setProject($formattedProject); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $subscriberClient->listSnapshots($request); + + /** @var Snapshot $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedProject = SubscriberClient::projectName('[PROJECT]'); + + list_snapshots_sample($formattedProject); +} +// [END pubsub_v1_generated_Subscriber_ListSnapshots_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_subscriptions.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_subscriptions.php new file mode 100644 index 000000000000..2ea97dfabe5e --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_subscriptions.php @@ -0,0 +1,77 @@ +setProject($formattedProject); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $subscriberClient->listSubscriptions($request); + + /** @var Subscription $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedProject = SubscriberClient::projectName('[PROJECT]'); + + list_subscriptions_sample($formattedProject); +} +// [END pubsub_v1_generated_Subscriber_ListSubscriptions_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_ack_deadline.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_ack_deadline.php new file mode 100644 index 000000000000..531956b0e383 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_ack_deadline.php @@ -0,0 +1,92 @@ +setSubscription($formattedSubscription) + ->setAckIds($ackIds) + ->setAckDeadlineSeconds($ackDeadlineSeconds); + + // Call the API and handle any network failures. + try { + $subscriberClient->modifyAckDeadline($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $ackIdsElement = '[ACK_IDS]'; + $ackDeadlineSeconds = 0; + + modify_ack_deadline_sample($formattedSubscription, $ackIdsElement, $ackDeadlineSeconds); +} +// [END pubsub_v1_generated_Subscriber_ModifyAckDeadline_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_push_config.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_push_config.php new file mode 100644 index 000000000000..efaef2f965d6 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_push_config.php @@ -0,0 +1,78 @@ +setSubscription($formattedSubscription) + ->setPushConfig($pushConfig); + + // Call the API and handle any network failures. + try { + $subscriberClient->modifyPushConfig($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + + modify_push_config_sample($formattedSubscription); +} +// [END pubsub_v1_generated_Subscriber_ModifyPushConfig_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/pull.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/pull.php new file mode 100644 index 000000000000..36a57b63ff47 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/pull.php @@ -0,0 +1,77 @@ +setSubscription($formattedSubscription) + ->setMaxMessages($maxMessages); + + // Call the API and handle any network failures. + try { + /** @var PullResponse $response */ + $response = $subscriberClient->pull($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $maxMessages = 0; + + pull_sample($formattedSubscription, $maxMessages); +} +// [END pubsub_v1_generated_Subscriber_Pull_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/seek.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/seek.php new file mode 100644 index 000000000000..0a17e35acc6c --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/seek.php @@ -0,0 +1,77 @@ +setSubscription($formattedSubscription); + + // Call the API and handle any network failures. + try { + /** @var SeekResponse $response */ + $response = $subscriberClient->seek($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + + seek_sample($formattedSubscription); +} +// [END pubsub_v1_generated_Subscriber_Seek_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/set_iam_policy.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/set_iam_policy.php new file mode 100644 index 000000000000..2f60a915d175 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/set_iam_policy.php @@ -0,0 +1,77 @@ +setResource($resource) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $subscriberClient->setIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END pubsub_v1_generated_Subscriber_SetIamPolicy_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/streaming_pull.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/streaming_pull.php new file mode 100644 index 000000000000..1c4ebff6908c --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/streaming_pull.php @@ -0,0 +1,92 @@ +setSubscription($formattedSubscription) + ->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds); + + // Call the API and handle any network failures. + try { + /** @var BidiStream $stream */ + $stream = $subscriberClient->streamingPull(); + $stream->writeAll([$request,]); + + /** @var StreamingPullResponse $element */ + foreach ($stream->closeWriteAndReadAll() as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $streamAckDeadlineSeconds = 0; + + streaming_pull_sample($formattedSubscription, $streamAckDeadlineSeconds); +} +// [END pubsub_v1_generated_Subscriber_StreamingPull_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/test_iam_permissions.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/test_iam_permissions.php new file mode 100644 index 000000000000..32207175dd09 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/test_iam_permissions.php @@ -0,0 +1,84 @@ +setResource($resource) + ->setPermissions($permissions); + + // Call the API and handle any network failures. + try { + /** @var TestIamPermissionsResponse $response */ + $response = $subscriberClient->testIamPermissions($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END pubsub_v1_generated_Subscriber_TestIamPermissions_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_snapshot.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_snapshot.php new file mode 100644 index 000000000000..bdd5bb3027dd --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_snapshot.php @@ -0,0 +1,67 @@ +setSnapshot($snapshot) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var Snapshot $response */ + $response = $subscriberClient->updateSnapshot($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END pubsub_v1_generated_Subscriber_UpdateSnapshot_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_subscription.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_subscription.php new file mode 100644 index 000000000000..e3eb7cee7f6a --- /dev/null +++ b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_subscription.php @@ -0,0 +1,90 @@ +setName($subscriptionName) + ->setTopic($formattedSubscriptionTopic); + $updateMask = new FieldMask(); + $request = (new UpdateSubscriptionRequest()) + ->setSubscription($subscription) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var Subscription $response */ + $response = $subscriberClient->updateSubscription($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $subscriptionName = '[NAME]'; + $formattedSubscriptionTopic = SubscriberClient::topicName('[PROJECT]', '[TOPIC]'); + + update_subscription_sample($subscriptionName, $formattedSubscriptionTopic); +} +// [END pubsub_v1_generated_Subscriber_UpdateSubscription_sync] diff --git a/owl-bot-staging/PubSub/v1/src/V1/Client/PublisherClient.php b/owl-bot-staging/PubSub/v1/src/V1/Client/PublisherClient.php new file mode 100644 index 000000000000..179d1ccd4abd --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/Client/PublisherClient.php @@ -0,0 +1,656 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/publisher_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/publisher_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/publisher_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/publisher_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * _deleted-topic_ resource. + * + * @return string The formatted _deleted-topic_ resource. + */ + public static function deletedTopicName(): string + { + return self::getPathTemplate('deletedTopic')->render([]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_topic resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted project_topic resource. + */ + public static function projectTopicName(string $project, string $topic): string + { + return self::getPathTemplate('projectTopic')->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a schema + * resource. + * + * @param string $project + * @param string $schema + * + * @return string The formatted schema resource. + */ + public static function schemaName(string $project, string $schema): string + { + return self::getPathTemplate('schema')->render([ + 'project' => $project, + 'schema' => $schema, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a subscription + * resource. + * + * @param string $project + * @param string $subscription + * + * @return string The formatted subscription resource. + */ + public static function subscriptionName(string $project, string $subscription): string + { + return self::getPathTemplate('subscription')->render([ + 'project' => $project, + 'subscription' => $subscription, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a topic + * resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted topic resource. + */ + public static function topicName(string $project, string $topic): string + { + return self::getPathTemplate('topic')->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - deletedTopic: _deleted-topic_ + * - project: projects/{project} + * - projectTopic: projects/{project}/topics/{topic} + * - schema: projects/{project}/schemas/{schema} + * - subscription: projects/{project}/subscriptions/{subscription} + * - topic: projects/{project}/topics/{topic} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'pubsub.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates the given topic with the given name. See the [resource name rules] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * + * The async variant is {@see PublisherClient::createTopicAsync()} . + * + * @example samples/V1/PublisherClient/create_topic.php + * + * @param Topic $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Topic + * + * @throws ApiException Thrown if the API call fails. + */ + public function createTopic(Topic $request, array $callOptions = []): Topic + { + return $this->startApiCall('CreateTopic', $request, $callOptions)->wait(); + } + + /** + * 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_`. + * + * The async variant is {@see PublisherClient::deleteTopicAsync()} . + * + * @example samples/V1/PublisherClient/delete_topic.php + * + * @param DeleteTopicRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteTopic(DeleteTopicRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteTopic', $request, $callOptions)->wait(); + } + + /** + * 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. + * + * The async variant is {@see PublisherClient::detachSubscriptionAsync()} . + * + * @example samples/V1/PublisherClient/detach_subscription.php + * + * @param DetachSubscriptionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return DetachSubscriptionResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function detachSubscription(DetachSubscriptionRequest $request, array $callOptions = []): DetachSubscriptionResponse + { + return $this->startApiCall('DetachSubscription', $request, $callOptions)->wait(); + } + + /** + * Gets the configuration of a topic. + * + * The async variant is {@see PublisherClient::getTopicAsync()} . + * + * @example samples/V1/PublisherClient/get_topic.php + * + * @param GetTopicRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Topic + * + * @throws ApiException Thrown if the API call fails. + */ + public function getTopic(GetTopicRequest $request, array $callOptions = []): Topic + { + return $this->startApiCall('GetTopic', $request, $callOptions)->wait(); + } + + /** + * Lists the names of the snapshots on this topic. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, + * which allow you to manage message acknowledgments in bulk. That is, you can + * set the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. + * + * The async variant is {@see PublisherClient::listTopicSnapshotsAsync()} . + * + * @example samples/V1/PublisherClient/list_topic_snapshots.php + * + * @param ListTopicSnapshotsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listTopicSnapshots(ListTopicSnapshotsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListTopicSnapshots', $request, $callOptions); + } + + /** + * Lists the names of the attached subscriptions on this topic. + * + * The async variant is {@see PublisherClient::listTopicSubscriptionsAsync()} . + * + * @example samples/V1/PublisherClient/list_topic_subscriptions.php + * + * @param ListTopicSubscriptionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listTopicSubscriptions(ListTopicSubscriptionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListTopicSubscriptions', $request, $callOptions); + } + + /** + * Lists matching topics. + * + * The async variant is {@see PublisherClient::listTopicsAsync()} . + * + * @example samples/V1/PublisherClient/list_topics.php + * + * @param ListTopicsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listTopics(ListTopicsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListTopics', $request, $callOptions); + } + + /** + * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic + * does not exist. + * + * The async variant is {@see PublisherClient::publishAsync()} . + * + * @example samples/V1/PublisherClient/publish.php + * + * @param PublishRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PublishResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function publish(PublishRequest $request, array $callOptions = []): PublishResponse + { + return $this->startApiCall('Publish', $request, $callOptions)->wait(); + } + + /** + * Updates an existing topic by updating the fields specified in the update + * mask. Note that certain properties of a topic are not modifiable. + * + * The async variant is {@see PublisherClient::updateTopicAsync()} . + * + * @example samples/V1/PublisherClient/update_topic.php + * + * @param UpdateTopicRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Topic + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateTopic(UpdateTopicRequest $request, array $callOptions = []): Topic + { + return $this->startApiCall('UpdateTopic', $request, $callOptions)->wait(); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see PublisherClient::getIamPolicyAsync()} . + * + * @example samples/V1/PublisherClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see PublisherClient::setIamPolicyAsync()} . + * + * @example samples/V1/PublisherClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * 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. + * + * The async variant is {@see PublisherClient::testIamPermissionsAsync()} . + * + * @example samples/V1/PublisherClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/PubSub/v1/src/V1/Client/SchemaServiceClient.php b/owl-bot-staging/PubSub/v1/src/V1/Client/SchemaServiceClient.php new file mode 100644 index 000000000000..5c320496d9cb --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/Client/SchemaServiceClient.php @@ -0,0 +1,604 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/schema_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/schema_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/schema_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/schema_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a schema + * resource. + * + * @param string $project + * @param string $schema + * + * @return string The formatted schema resource. + */ + public static function schemaName(string $project, string $schema): string + { + return self::getPathTemplate('schema')->render([ + 'project' => $project, + 'schema' => $schema, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * - schema: projects/{project}/schemas/{schema} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'pubsub.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Commits a new schema revision to an existing schema. + * + * The async variant is {@see SchemaServiceClient::commitSchemaAsync()} . + * + * @example samples/V1/SchemaServiceClient/commit_schema.php + * + * @param CommitSchemaRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Schema + * + * @throws ApiException Thrown if the API call fails. + */ + public function commitSchema(CommitSchemaRequest $request, array $callOptions = []): Schema + { + return $this->startApiCall('CommitSchema', $request, $callOptions)->wait(); + } + + /** + * Creates a schema. + * + * The async variant is {@see SchemaServiceClient::createSchemaAsync()} . + * + * @example samples/V1/SchemaServiceClient/create_schema.php + * + * @param CreateSchemaRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Schema + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSchema(CreateSchemaRequest $request, array $callOptions = []): Schema + { + return $this->startApiCall('CreateSchema', $request, $callOptions)->wait(); + } + + /** + * Deletes a schema. + * + * The async variant is {@see SchemaServiceClient::deleteSchemaAsync()} . + * + * @example samples/V1/SchemaServiceClient/delete_schema.php + * + * @param DeleteSchemaRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteSchema(DeleteSchemaRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteSchema', $request, $callOptions)->wait(); + } + + /** + * Deletes a specific schema revision. + * + * The async variant is {@see SchemaServiceClient::deleteSchemaRevisionAsync()} . + * + * @example samples/V1/SchemaServiceClient/delete_schema_revision.php + * + * @param DeleteSchemaRevisionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Schema + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteSchemaRevision(DeleteSchemaRevisionRequest $request, array $callOptions = []): Schema + { + return $this->startApiCall('DeleteSchemaRevision', $request, $callOptions)->wait(); + } + + /** + * Gets a schema. + * + * The async variant is {@see SchemaServiceClient::getSchemaAsync()} . + * + * @example samples/V1/SchemaServiceClient/get_schema.php + * + * @param GetSchemaRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Schema + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSchema(GetSchemaRequest $request, array $callOptions = []): Schema + { + return $this->startApiCall('GetSchema', $request, $callOptions)->wait(); + } + + /** + * Lists all schema revisions for the named schema. + * + * The async variant is {@see SchemaServiceClient::listSchemaRevisionsAsync()} . + * + * @example samples/V1/SchemaServiceClient/list_schema_revisions.php + * + * @param ListSchemaRevisionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSchemaRevisions(ListSchemaRevisionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSchemaRevisions', $request, $callOptions); + } + + /** + * Lists schemas in a project. + * + * The async variant is {@see SchemaServiceClient::listSchemasAsync()} . + * + * @example samples/V1/SchemaServiceClient/list_schemas.php + * + * @param ListSchemasRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSchemas(ListSchemasRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSchemas', $request, $callOptions); + } + + /** + * Creates a new schema revision that is a copy of the provided revision_id. + * + * The async variant is {@see SchemaServiceClient::rollbackSchemaAsync()} . + * + * @example samples/V1/SchemaServiceClient/rollback_schema.php + * + * @param RollbackSchemaRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Schema + * + * @throws ApiException Thrown if the API call fails. + */ + public function rollbackSchema(RollbackSchemaRequest $request, array $callOptions = []): Schema + { + return $this->startApiCall('RollbackSchema', $request, $callOptions)->wait(); + } + + /** + * Validates a message against a schema. + * + * The async variant is {@see SchemaServiceClient::validateMessageAsync()} . + * + * @example samples/V1/SchemaServiceClient/validate_message.php + * + * @param ValidateMessageRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ValidateMessageResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function validateMessage(ValidateMessageRequest $request, array $callOptions = []): ValidateMessageResponse + { + return $this->startApiCall('ValidateMessage', $request, $callOptions)->wait(); + } + + /** + * Validates a schema. + * + * The async variant is {@see SchemaServiceClient::validateSchemaAsync()} . + * + * @example samples/V1/SchemaServiceClient/validate_schema.php + * + * @param ValidateSchemaRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ValidateSchemaResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function validateSchema(ValidateSchemaRequest $request, array $callOptions = []): ValidateSchemaResponse + { + return $this->startApiCall('ValidateSchema', $request, $callOptions)->wait(); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see SchemaServiceClient::getIamPolicyAsync()} . + * + * @example samples/V1/SchemaServiceClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see SchemaServiceClient::setIamPolicyAsync()} . + * + * @example samples/V1/SchemaServiceClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * 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. + * + * The async variant is {@see SchemaServiceClient::testIamPermissionsAsync()} . + * + * @example samples/V1/SchemaServiceClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/PubSub/v1/src/V1/Client/SubscriberClient.php b/owl-bot-staging/PubSub/v1/src/V1/Client/SubscriberClient.php new file mode 100644 index 000000000000..97e628a8c42b --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/Client/SubscriberClient.php @@ -0,0 +1,905 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/subscriber_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/subscriber_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/subscriber_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/subscriber_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * _deleted-topic_ resource. + * + * @return string The formatted _deleted-topic_ resource. + */ + public static function deletedTopicName(): string + { + return self::getPathTemplate('deletedTopic')->render([]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_topic resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted project_topic resource. + */ + public static function projectTopicName(string $project, string $topic): string + { + return self::getPathTemplate('projectTopic')->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a snapshot + * resource. + * + * @param string $project + * @param string $snapshot + * + * @return string The formatted snapshot resource. + */ + public static function snapshotName(string $project, string $snapshot): string + { + return self::getPathTemplate('snapshot')->render([ + 'project' => $project, + 'snapshot' => $snapshot, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a subscription + * resource. + * + * @param string $project + * @param string $subscription + * + * @return string The formatted subscription resource. + */ + public static function subscriptionName(string $project, string $subscription): string + { + return self::getPathTemplate('subscription')->render([ + 'project' => $project, + 'subscription' => $subscription, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a topic + * resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted topic resource. + */ + public static function topicName(string $project, string $topic): string + { + return self::getPathTemplate('topic')->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - deletedTopic: _deleted-topic_ + * - project: projects/{project} + * - projectTopic: projects/{project}/topics/{topic} + * - snapshot: projects/{project}/snapshots/{snapshot} + * - subscription: projects/{project}/subscriptions/{subscription} + * - topic: projects/{project}/topics/{topic} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'pubsub.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Acknowledges the messages associated with the `ack_ids` in the + * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages + * from the subscription. + * + * Acknowledging a message whose ack deadline has expired may succeed, + * but such a message may be redelivered later. Acknowledging a message more + * than once will not result in an error. + * + * The async variant is {@see SubscriberClient::acknowledgeAsync()} . + * + * @example samples/V1/SubscriberClient/acknowledge.php + * + * @param AcknowledgeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function acknowledge(AcknowledgeRequest $request, array $callOptions = []): void + { + $this->startApiCall('Acknowledge', $request, $callOptions)->wait(); + } + + /** + * Creates a snapshot from the requested subscription. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, + * which allow you to manage message acknowledgments in bulk. That is, you can + * set the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. + * If the snapshot already exists, returns `ALREADY_EXISTS`. + * If the requested subscription doesn't exist, returns `NOT_FOUND`. + * If the backlog in the subscription is too old -- and the resulting snapshot + * would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. + * See also the `Snapshot.expire_time` field. If the name is not provided in + * the request, the server will assign a random + * name for this snapshot on the same project as the subscription, conforming + * to the [resource name format] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The + * generated name is populated in the returned Snapshot object. Note that for + * REST API requests, you must specify a name in the request. + * + * The async variant is {@see SubscriberClient::createSnapshotAsync()} . + * + * @example samples/V1/SubscriberClient/create_snapshot.php + * + * @param CreateSnapshotRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Snapshot + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSnapshot(CreateSnapshotRequest $request, array $callOptions = []): Snapshot + { + return $this->startApiCall('CreateSnapshot', $request, $callOptions)->wait(); + } + + /** + * Creates a subscription to a given topic. See the [resource name rules] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * If the subscription already exists, returns `ALREADY_EXISTS`. + * If the corresponding topic doesn't exist, returns `NOT_FOUND`. + * + * If the name is not provided in the request, the server will assign a random + * name for this subscription on the same project as the topic, conforming + * to the [resource name format] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The + * generated name is populated in the returned Subscription object. Note that + * for REST API requests, you must specify a name in the request. + * + * The async variant is {@see SubscriberClient::createSubscriptionAsync()} . + * + * @example samples/V1/SubscriberClient/create_subscription.php + * + * @param Subscription $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Subscription + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSubscription(Subscription $request, array $callOptions = []): Subscription + { + return $this->startApiCall('CreateSubscription', $request, $callOptions)->wait(); + } + + /** + * Removes an existing snapshot. Snapshots are used in [Seek] + * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which + * allow you to manage message acknowledgments in bulk. That is, you can set + * the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. + * When the snapshot is deleted, all messages retained in the snapshot + * are immediately dropped. After a snapshot is deleted, a new one may be + * created with the same name, but the new one has no association with the old + * snapshot or its subscription, unless the same subscription is specified. + * + * The async variant is {@see SubscriberClient::deleteSnapshotAsync()} . + * + * @example samples/V1/SubscriberClient/delete_snapshot.php + * + * @param DeleteSnapshotRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteSnapshot(DeleteSnapshotRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteSnapshot', $request, $callOptions)->wait(); + } + + /** + * Deletes an existing subscription. All messages retained in the subscription + * are immediately dropped. Calls to `Pull` after deletion will return + * `NOT_FOUND`. After a subscription is deleted, a new one may be created with + * the same name, but the new one has no association with the old + * subscription or its topic unless the same topic is specified. + * + * The async variant is {@see SubscriberClient::deleteSubscriptionAsync()} . + * + * @example samples/V1/SubscriberClient/delete_subscription.php + * + * @param DeleteSubscriptionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteSubscription(DeleteSubscriptionRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteSubscription', $request, $callOptions)->wait(); + } + + /** + * Gets the configuration details of a snapshot. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, + * which allow you to manage message acknowledgments in bulk. That is, you can + * set the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. + * + * The async variant is {@see SubscriberClient::getSnapshotAsync()} . + * + * @example samples/V1/SubscriberClient/get_snapshot.php + * + * @param GetSnapshotRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Snapshot + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSnapshot(GetSnapshotRequest $request, array $callOptions = []): Snapshot + { + return $this->startApiCall('GetSnapshot', $request, $callOptions)->wait(); + } + + /** + * Gets the configuration details of a subscription. + * + * The async variant is {@see SubscriberClient::getSubscriptionAsync()} . + * + * @example samples/V1/SubscriberClient/get_subscription.php + * + * @param GetSubscriptionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Subscription + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSubscription(GetSubscriptionRequest $request, array $callOptions = []): Subscription + { + return $this->startApiCall('GetSubscription', $request, $callOptions)->wait(); + } + + /** + * Lists the existing snapshots. Snapshots are used in [Seek]( + * https://cloud.google.com/pubsub/docs/replay-overview) operations, which + * allow you to manage message acknowledgments in bulk. That is, you can set + * the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. + * + * The async variant is {@see SubscriberClient::listSnapshotsAsync()} . + * + * @example samples/V1/SubscriberClient/list_snapshots.php + * + * @param ListSnapshotsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSnapshots(ListSnapshotsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSnapshots', $request, $callOptions); + } + + /** + * Lists matching subscriptions. + * + * The async variant is {@see SubscriberClient::listSubscriptionsAsync()} . + * + * @example samples/V1/SubscriberClient/list_subscriptions.php + * + * @param ListSubscriptionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSubscriptions(ListSubscriptionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSubscriptions', $request, $callOptions); + } + + /** + * Modifies the ack deadline for a specific message. This method is useful + * to indicate that more time is needed to process a message by the + * subscriber, or to make the message available for redelivery if the + * processing was interrupted. Note that this does not modify the + * subscription-level `ackDeadlineSeconds` used for subsequent messages. + * + * The async variant is {@see SubscriberClient::modifyAckDeadlineAsync()} . + * + * @example samples/V1/SubscriberClient/modify_ack_deadline.php + * + * @param ModifyAckDeadlineRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function modifyAckDeadline(ModifyAckDeadlineRequest $request, array $callOptions = []): void + { + $this->startApiCall('ModifyAckDeadline', $request, $callOptions)->wait(); + } + + /** + * Modifies the `PushConfig` for a specified subscription. + * + * This may be used to change a push subscription to a pull one (signified by + * an empty `PushConfig`) or vice versa, or change the endpoint URL and other + * attributes of a push subscription. Messages will accumulate for delivery + * continuously through the call regardless of changes to the `PushConfig`. + * + * The async variant is {@see SubscriberClient::modifyPushConfigAsync()} . + * + * @example samples/V1/SubscriberClient/modify_push_config.php + * + * @param ModifyPushConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function modifyPushConfig(ModifyPushConfigRequest $request, array $callOptions = []): void + { + $this->startApiCall('ModifyPushConfig', $request, $callOptions)->wait(); + } + + /** + * Pulls messages from the server. + * + * The async variant is {@see SubscriberClient::pullAsync()} . + * + * @example samples/V1/SubscriberClient/pull.php + * + * @param PullRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PullResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function pull(PullRequest $request, array $callOptions = []): PullResponse + { + return $this->startApiCall('Pull', $request, $callOptions)->wait(); + } + + /** + * Seeks an existing subscription to a point in time or to a given snapshot, + * whichever is provided in the request. Snapshots are used in [Seek] + * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which + * allow you to manage message acknowledgments in bulk. That is, you can set + * the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. Note that both the subscription and the + * snapshot must be on the same topic. + * + * The async variant is {@see SubscriberClient::seekAsync()} . + * + * @example samples/V1/SubscriberClient/seek.php + * + * @param SeekRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return SeekResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function seek(SeekRequest $request, array $callOptions = []): SeekResponse + { + return $this->startApiCall('Seek', $request, $callOptions)->wait(); + } + + /** + * Establishes a stream with the server, which sends messages down to the + * client. The client streams acknowledgements and ack deadline modifications + * back to the server. The server will close the stream and return the status + * on any error. The server may close the stream with status `UNAVAILABLE` to + * reassign server-side resources, in which case, the client should + * re-establish the stream. Flow control can be achieved by configuring the + * underlying RPC channel. + * + * @example samples/V1/SubscriberClient/streaming_pull.php + * + * @param array $callOptions { + * Optional. + * + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return BidiStream + * + * @throws ApiException Thrown if the API call fails. + */ + public function streamingPull(array $callOptions = []): BidiStream + { + return $this->startApiCall('StreamingPull', null, $callOptions); + } + + /** + * Updates an existing snapshot by updating the fields specified in the update + * mask. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, + * which allow you to manage message acknowledgments in bulk. That is, you can + * set the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. + * + * The async variant is {@see SubscriberClient::updateSnapshotAsync()} . + * + * @example samples/V1/SubscriberClient/update_snapshot.php + * + * @param UpdateSnapshotRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Snapshot + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSnapshot(UpdateSnapshotRequest $request, array $callOptions = []): Snapshot + { + return $this->startApiCall('UpdateSnapshot', $request, $callOptions)->wait(); + } + + /** + * Updates an existing subscription by updating the fields specified in the + * update mask. Note that certain properties of a subscription, such as its + * topic, are not modifiable. + * + * The async variant is {@see SubscriberClient::updateSubscriptionAsync()} . + * + * @example samples/V1/SubscriberClient/update_subscription.php + * + * @param UpdateSubscriptionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Subscription + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSubscription(UpdateSubscriptionRequest $request, array $callOptions = []): Subscription + { + return $this->startApiCall('UpdateSubscription', $request, $callOptions)->wait(); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see SubscriberClient::getIamPolicyAsync()} . + * + * @example samples/V1/SubscriberClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see SubscriberClient::setIamPolicyAsync()} . + * + * @example samples/V1/SubscriberClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * 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. + * + * The async variant is {@see SubscriberClient::testIamPermissionsAsync()} . + * + * @example samples/V1/SubscriberClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/PubSub/v1/src/V1/Gapic/PublisherGapicClient.php b/owl-bot-staging/PubSub/v1/src/V1/Gapic/PublisherGapicClient.php new file mode 100644 index 000000000000..51dde331c06d --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/Gapic/PublisherGapicClient.php @@ -0,0 +1,1117 @@ +createTopic($name); + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\PubSub\V1\Client\PublisherClient}. + */ +class PublisherGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.pubsub.v1.Publisher'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'pubsub.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'pubsub.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/pubsub', + ]; + + private static $deletedTopicNameTemplate; + + private static $projectNameTemplate; + + private static $projectTopicNameTemplate; + + private static $schemaNameTemplate; + + private static $subscriptionNameTemplate; + + private static $topicNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/publisher_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/publisher_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/publisher_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/publisher_rest_client_config.php', + ], + ], + ]; + } + + private static function getDeletedTopicNameTemplate() + { + if (self::$deletedTopicNameTemplate == null) { + self::$deletedTopicNameTemplate = new PathTemplate('_deleted-topic_'); + } + + return self::$deletedTopicNameTemplate; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getProjectTopicNameTemplate() + { + if (self::$projectTopicNameTemplate == null) { + self::$projectTopicNameTemplate = new PathTemplate('projects/{project}/topics/{topic}'); + } + + return self::$projectTopicNameTemplate; + } + + private static function getSchemaNameTemplate() + { + if (self::$schemaNameTemplate == null) { + self::$schemaNameTemplate = new PathTemplate('projects/{project}/schemas/{schema}'); + } + + return self::$schemaNameTemplate; + } + + private static function getSubscriptionNameTemplate() + { + if (self::$subscriptionNameTemplate == null) { + self::$subscriptionNameTemplate = new PathTemplate('projects/{project}/subscriptions/{subscription}'); + } + + return self::$subscriptionNameTemplate; + } + + private static function getTopicNameTemplate() + { + if (self::$topicNameTemplate == null) { + self::$topicNameTemplate = new PathTemplate('projects/{project}/topics/{topic}'); + } + + return self::$topicNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'deletedTopic' => self::getDeletedTopicNameTemplate(), + 'project' => self::getProjectNameTemplate(), + 'projectTopic' => self::getProjectTopicNameTemplate(), + 'schema' => self::getSchemaNameTemplate(), + 'subscription' => self::getSubscriptionNameTemplate(), + 'topic' => self::getTopicNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * _deleted-topic_ resource. + * + * @return string The formatted _deleted-topic_ resource. + */ + public static function deletedTopicName() + { + return self::getDeletedTopicNameTemplate()->render([]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_topic resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted project_topic resource. + */ + public static function projectTopicName($project, $topic) + { + return self::getProjectTopicNameTemplate()->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a schema + * resource. + * + * @param string $project + * @param string $schema + * + * @return string The formatted schema resource. + */ + public static function schemaName($project, $schema) + { + return self::getSchemaNameTemplate()->render([ + 'project' => $project, + 'schema' => $schema, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a subscription + * resource. + * + * @param string $project + * @param string $subscription + * + * @return string The formatted subscription resource. + */ + public static function subscriptionName($project, $subscription) + { + return self::getSubscriptionNameTemplate()->render([ + 'project' => $project, + 'subscription' => $subscription, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a topic + * resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted topic resource. + */ + public static function topicName($project, $topic) + { + return self::getTopicNameTemplate()->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - deletedTopic: _deleted-topic_ + * - project: projects/{project} + * - projectTopic: projects/{project}/topics/{topic} + * - schema: projects/{project}/schemas/{schema} + * - subscription: projects/{project}/subscriptions/{subscription} + * - topic: projects/{project}/topics/{topic} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'pubsub.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates the given topic with the given name. See the [resource name rules] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $name = 'name'; + * $response = $publisherClient->createTopic($name); + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param 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"`. + * @param array $optionalArgs { + * Optional. + * + * @type array $labels + * Optional. See [Creating and managing labels] + * (https://cloud.google.com/pubsub/docs/labels). + * @type MessageStoragePolicy $messageStoragePolicy + * Optional. Policy constraining the set of Google Cloud Platform regions + * where messages published to the topic may be stored. If not present, then + * no constraints are in effect. + * @type string $kmsKeyName + * Optional. The resource name of the Cloud KMS CryptoKey to be used to + * protect access to messages published on this topic. + * + * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + * @type SchemaSettings $schemaSettings + * Optional. Settings for validating messages published against a schema. + * @type bool $satisfiesPzs + * Optional. Reserved for future use. This field is set only in responses from + * the server; it is ignored if it is set in any requests. + * @type Duration $messageRetentionDuration + * Optional. Indicates the minimum duration to retain a message after it is + * published to the topic. If this field is set, messages published to the + * topic in the last `message_retention_duration` are always available to + * subscribers. For instance, it allows any attached subscription to [seek to + * a + * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) + * that is up to `message_retention_duration` in the past. If this field is + * not set, message retention is controlled by settings on individual + * subscriptions. Cannot be more than 31 days or less than 10 minutes. + * @type int $state + * Output only. An output-only field indicating the state of the topic. + * For allowed values, use constants defined on {@see \Google\Cloud\PubSub\V1\Topic\State} + * @type IngestionDataSourceSettings $ingestionDataSourceSettings + * Optional. Settings for ingestion from a data source into this topic. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Topic + * + * @throws ApiException if the remote call fails + */ + public function createTopic($name, array $optionalArgs = []) + { + $request = new Topic(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + if (isset($optionalArgs['messageStoragePolicy'])) { + $request->setMessageStoragePolicy($optionalArgs['messageStoragePolicy']); + } + + if (isset($optionalArgs['kmsKeyName'])) { + $request->setKmsKeyName($optionalArgs['kmsKeyName']); + } + + if (isset($optionalArgs['schemaSettings'])) { + $request->setSchemaSettings($optionalArgs['schemaSettings']); + } + + if (isset($optionalArgs['satisfiesPzs'])) { + $request->setSatisfiesPzs($optionalArgs['satisfiesPzs']); + } + + if (isset($optionalArgs['messageRetentionDuration'])) { + $request->setMessageRetentionDuration($optionalArgs['messageRetentionDuration']); + } + + if (isset($optionalArgs['state'])) { + $request->setState($optionalArgs['state']); + } + + if (isset($optionalArgs['ingestionDataSourceSettings'])) { + $request->setIngestionDataSourceSettings($optionalArgs['ingestionDataSourceSettings']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateTopic', Topic::class, $optionalArgs, $request)->wait(); + } + + /** + * 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_`. + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); + * $publisherClient->deleteTopic($formattedTopic); + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param string $topic Required. Name of the topic to delete. + * Format is `projects/{project}/topics/{topic}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteTopic($topic, array $optionalArgs = []) + { + $request = new DeleteTopicRequest(); + $requestParamHeaders = []; + $request->setTopic($topic); + $requestParamHeaders['topic'] = $topic; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteTopic', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * 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. + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $formattedSubscription = $publisherClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + * $response = $publisherClient->detachSubscription($formattedSubscription); + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param string $subscription Required. The subscription to detach. + * Format is `projects/{project}/subscriptions/{subscription}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\DetachSubscriptionResponse + * + * @throws ApiException if the remote call fails + */ + public function detachSubscription($subscription, array $optionalArgs = []) + { + $request = new DetachSubscriptionRequest(); + $requestParamHeaders = []; + $request->setSubscription($subscription); + $requestParamHeaders['subscription'] = $subscription; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DetachSubscription', DetachSubscriptionResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the configuration of a topic. + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); + * $response = $publisherClient->getTopic($formattedTopic); + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param string $topic Required. The name of the topic to get. + * Format is `projects/{project}/topics/{topic}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Topic + * + * @throws ApiException if the remote call fails + */ + public function getTopic($topic, array $optionalArgs = []) + { + $request = new GetTopicRequest(); + $requestParamHeaders = []; + $request->setTopic($topic); + $requestParamHeaders['topic'] = $topic; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetTopic', Topic::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists the names of the snapshots on this topic. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, + * which allow you to manage message acknowledgments in bulk. That is, you can + * set the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); + * // Iterate over pages of elements + * $pagedResponse = $publisherClient->listTopicSnapshots($formattedTopic); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $publisherClient->listTopicSnapshots($formattedTopic); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param string $topic Required. The name of the topic that snapshots are attached to. + * Format is `projects/{project}/topics/{topic}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listTopicSnapshots($topic, array $optionalArgs = []) + { + $request = new ListTopicSnapshotsRequest(); + $requestParamHeaders = []; + $request->setTopic($topic); + $requestParamHeaders['topic'] = $topic; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListTopicSnapshots', $optionalArgs, ListTopicSnapshotsResponse::class, $request); + } + + /** + * Lists the names of the attached subscriptions on this topic. + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); + * // Iterate over pages of elements + * $pagedResponse = $publisherClient->listTopicSubscriptions($formattedTopic); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $publisherClient->listTopicSubscriptions($formattedTopic); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param string $topic Required. The name of the topic that subscriptions are attached to. + * Format is `projects/{project}/topics/{topic}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listTopicSubscriptions($topic, array $optionalArgs = []) + { + $request = new ListTopicSubscriptionsRequest(); + $requestParamHeaders = []; + $request->setTopic($topic); + $requestParamHeaders['topic'] = $topic; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListTopicSubscriptions', $optionalArgs, ListTopicSubscriptionsResponse::class, $request); + } + + /** + * Lists matching topics. + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $formattedProject = $publisherClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $publisherClient->listTopics($formattedProject); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $publisherClient->listTopics($formattedProject); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param string $project Required. The name of the project in which to list topics. + * Format is `projects/{project-id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listTopics($project, array $optionalArgs = []) + { + $request = new ListTopicsRequest(); + $requestParamHeaders = []; + $request->setProject($project); + $requestParamHeaders['project'] = $project; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListTopics', $optionalArgs, ListTopicsResponse::class, $request); + } + + /** + * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic + * does not exist. + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); + * $messages = []; + * $response = $publisherClient->publish($formattedTopic, $messages); + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param string $topic Required. The messages in the request will be published on this topic. + * Format is `projects/{project}/topics/{topic}`. + * @param PubsubMessage[] $messages Required. The messages to publish. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\PublishResponse + * + * @throws ApiException if the remote call fails + */ + public function publish($topic, $messages, array $optionalArgs = []) + { + $request = new PublishRequest(); + $requestParamHeaders = []; + $request->setTopic($topic); + $request->setMessages($messages); + $requestParamHeaders['topic'] = $topic; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('Publish', PublishResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates an existing topic by updating the fields specified in the update + * mask. Note that certain properties of a topic are not modifiable. + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $topic = new Topic(); + * $updateMask = new FieldMask(); + * $response = $publisherClient->updateTopic($topic, $updateMask); + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param Topic $topic Required. The updated topic object. + * @param FieldMask $updateMask Required. Indicates which fields in the provided topic to update. Must be + * specified and non-empty. Note that if `update_mask` contains + * "message_storage_policy" but the `message_storage_policy` is not set in + * the `topic` provided above, then the updated value is determined by the + * policy configured at the project or organization level. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Topic + * + * @throws ApiException if the remote call fails + */ + public function updateTopic($topic, $updateMask, array $optionalArgs = []) + { + $request = new UpdateTopicRequest(); + $requestParamHeaders = []; + $request->setTopic($topic); + $request->setUpdateMask($updateMask); + $requestParamHeaders['topic.name'] = $topic->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateTopic', Topic::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $resource = 'resource'; + * $response = $publisherClient->getIamPolicy($resource); + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $publisherClient->setIamPolicy($resource, $policy); + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * 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. + * + * Sample code: + * ``` + * $publisherClient = new PublisherClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $publisherClient->testIamPermissions($resource, $permissions); + * } finally { + * $publisherClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } +} diff --git a/owl-bot-staging/PubSub/v1/src/V1/Gapic/SchemaServiceGapicClient.php b/owl-bot-staging/PubSub/v1/src/V1/Gapic/SchemaServiceGapicClient.php new file mode 100644 index 000000000000..496f7d0174ad --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/Gapic/SchemaServiceGapicClient.php @@ -0,0 +1,1006 @@ +schemaName('[PROJECT]', '[SCHEMA]'); + * $schema = new Schema(); + * $response = $schemaServiceClient->commitSchema($formattedName, $schema); + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\PubSub\V1\Client\SchemaServiceClient}. + */ +class SchemaServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.pubsub.v1.SchemaService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'pubsub.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'pubsub.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/pubsub', + ]; + + private static $projectNameTemplate; + + private static $schemaNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/schema_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/schema_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/schema_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/schema_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getSchemaNameTemplate() + { + if (self::$schemaNameTemplate == null) { + self::$schemaNameTemplate = new PathTemplate('projects/{project}/schemas/{schema}'); + } + + return self::$schemaNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'project' => self::getProjectNameTemplate(), + 'schema' => self::getSchemaNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a schema + * resource. + * + * @param string $project + * @param string $schema + * + * @return string The formatted schema resource. + */ + public static function schemaName($project, $schema) + { + return self::getSchemaNameTemplate()->render([ + 'project' => $project, + 'schema' => $schema, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * - schema: projects/{project}/schemas/{schema} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'pubsub.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Commits a new schema revision to an existing schema. + * + * Sample code: + * ``` + * $schemaServiceClient = new SchemaServiceClient(); + * try { + * $formattedName = $schemaServiceClient->schemaName('[PROJECT]', '[SCHEMA]'); + * $schema = new Schema(); + * $response = $schemaServiceClient->commitSchema($formattedName, $schema); + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the schema we are revising. + * Format is `projects/{project}/schemas/{schema}`. + * @param Schema $schema Required. The schema revision to commit. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Schema + * + * @throws ApiException if the remote call fails + */ + public function commitSchema($name, $schema, array $optionalArgs = []) + { + $request = new CommitSchemaRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setSchema($schema); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CommitSchema', Schema::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a schema. + * + * Sample code: + * ``` + * $schemaServiceClient = new SchemaServiceClient(); + * try { + * $formattedParent = $schemaServiceClient->projectName('[PROJECT]'); + * $schema = new Schema(); + * $response = $schemaServiceClient->createSchema($formattedParent, $schema); + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project in which to create the schema. + * Format is `projects/{project-id}`. + * @param Schema $schema Required. The schema object to create. + * + * This schema's `name` parameter is ignored. The schema object returned + * by CreateSchema will have a `name` made using the given `parent` and + * `schema_id`. + * @param array $optionalArgs { + * Optional. + * + * @type string $schemaId + * The ID to use for the schema, which will become the final component of + * the schema's resource name. + * + * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for + * resource name constraints. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Schema + * + * @throws ApiException if the remote call fails + */ + public function createSchema($parent, $schema, array $optionalArgs = []) + { + $request = new CreateSchemaRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setSchema($schema); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['schemaId'])) { + $request->setSchemaId($optionalArgs['schemaId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateSchema', Schema::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a schema. + * + * Sample code: + * ``` + * $schemaServiceClient = new SchemaServiceClient(); + * try { + * $formattedName = $schemaServiceClient->schemaName('[PROJECT]', '[SCHEMA]'); + * $schemaServiceClient->deleteSchema($formattedName); + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the schema to delete. + * Format is `projects/{project}/schemas/{schema}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteSchema($name, array $optionalArgs = []) + { + $request = new DeleteSchemaRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteSchema', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a specific schema revision. + * + * Sample code: + * ``` + * $schemaServiceClient = new SchemaServiceClient(); + * try { + * $formattedName = $schemaServiceClient->schemaName('[PROJECT]', '[SCHEMA]'); + * $revisionId = 'revision_id'; + * $response = $schemaServiceClient->deleteSchemaRevision($formattedName, $revisionId); + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the schema revision to be deleted, with a revision ID + * explicitly included. + * + * Example: `projects/123/schemas/my-schema@c7cfa2a8` + * @param string $revisionId Optional. This field is deprecated and should not be used for specifying + * the revision ID. The revision ID should be specified via the `name` + * parameter. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Schema + * + * @throws ApiException if the remote call fails + */ + public function deleteSchemaRevision($name, $revisionId, array $optionalArgs = []) + { + $request = new DeleteSchemaRevisionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setRevisionId($revisionId); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteSchemaRevision', Schema::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a schema. + * + * Sample code: + * ``` + * $schemaServiceClient = new SchemaServiceClient(); + * try { + * $formattedName = $schemaServiceClient->schemaName('[PROJECT]', '[SCHEMA]'); + * $response = $schemaServiceClient->getSchema($formattedName); + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the schema to get. + * Format is `projects/{project}/schemas/{schema}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $view + * The set of fields to return in the response. If not set, returns a Schema + * with all fields filled out. Set to `BASIC` to omit the `definition`. + * For allowed values, use constants defined on {@see \Google\Cloud\PubSub\V1\SchemaView} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Schema + * + * @throws ApiException if the remote call fails + */ + public function getSchema($name, array $optionalArgs = []) + { + $request = new GetSchemaRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSchema', Schema::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists all schema revisions for the named schema. + * + * Sample code: + * ``` + * $schemaServiceClient = new SchemaServiceClient(); + * try { + * $formattedName = $schemaServiceClient->schemaName('[PROJECT]', '[SCHEMA]'); + * // Iterate over pages of elements + * $pagedResponse = $schemaServiceClient->listSchemaRevisions($formattedName); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $schemaServiceClient->listSchemaRevisions($formattedName); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the schema to list revisions for. + * @param array $optionalArgs { + * Optional. + * + * @type int $view + * The set of Schema fields to return in the response. If not set, returns + * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to + * retrieve all fields. + * For allowed values, use constants defined on {@see \Google\Cloud\PubSub\V1\SchemaView} + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listSchemaRevisions($name, array $optionalArgs = []) + { + $request = new ListSchemaRevisionsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListSchemaRevisions', $optionalArgs, ListSchemaRevisionsResponse::class, $request); + } + + /** + * Lists schemas in a project. + * + * Sample code: + * ``` + * $schemaServiceClient = new SchemaServiceClient(); + * try { + * $formattedParent = $schemaServiceClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $schemaServiceClient->listSchemas($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $schemaServiceClient->listSchemas($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project in which to list schemas. + * Format is `projects/{project-id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $view + * The set of Schema fields to return in the response. If not set, returns + * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to + * retrieve all fields. + * For allowed values, use constants defined on {@see \Google\Cloud\PubSub\V1\SchemaView} + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listSchemas($parent, array $optionalArgs = []) + { + $request = new ListSchemasRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListSchemas', $optionalArgs, ListSchemasResponse::class, $request); + } + + /** + * Creates a new schema revision that is a copy of the provided revision_id. + * + * Sample code: + * ``` + * $schemaServiceClient = new SchemaServiceClient(); + * try { + * $formattedName = $schemaServiceClient->schemaName('[PROJECT]', '[SCHEMA]'); + * $revisionId = 'revision_id'; + * $response = $schemaServiceClient->rollbackSchema($formattedName, $revisionId); + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The schema being rolled back with revision id. + * @param string $revisionId Required. The revision ID to roll back to. + * It must be a revision of the same schema. + * + * Example: c7cfa2a8 + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Schema + * + * @throws ApiException if the remote call fails + */ + public function rollbackSchema($name, $revisionId, array $optionalArgs = []) + { + $request = new RollbackSchemaRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setRevisionId($revisionId); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('RollbackSchema', Schema::class, $optionalArgs, $request)->wait(); + } + + /** + * Validates a message against a schema. + * + * Sample code: + * ``` + * $schemaServiceClient = new SchemaServiceClient(); + * try { + * $formattedParent = $schemaServiceClient->projectName('[PROJECT]'); + * $response = $schemaServiceClient->validateMessage($formattedParent); + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project in which to validate schemas. + * Format is `projects/{project-id}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Name of the schema against which to validate. + * + * Format is `projects/{project}/schemas/{schema}`. + * @type Schema $schema + * Ad-hoc schema against which to validate + * @type string $message + * Message to validate against the provided `schema_spec`. + * @type int $encoding + * The encoding expected for messages + * For allowed values, use constants defined on {@see \Google\Cloud\PubSub\V1\Encoding} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\ValidateMessageResponse + * + * @throws ApiException if the remote call fails + */ + public function validateMessage($parent, array $optionalArgs = []) + { + $request = new ValidateMessageRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + } + + if (isset($optionalArgs['schema'])) { + $request->setSchema($optionalArgs['schema']); + } + + if (isset($optionalArgs['message'])) { + $request->setMessage($optionalArgs['message']); + } + + if (isset($optionalArgs['encoding'])) { + $request->setEncoding($optionalArgs['encoding']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ValidateMessage', ValidateMessageResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Validates a schema. + * + * Sample code: + * ``` + * $schemaServiceClient = new SchemaServiceClient(); + * try { + * $formattedParent = $schemaServiceClient->projectName('[PROJECT]'); + * $schema = new Schema(); + * $response = $schemaServiceClient->validateSchema($formattedParent, $schema); + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project in which to validate schemas. + * Format is `projects/{project-id}`. + * @param Schema $schema Required. The schema object to validate. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\ValidateSchemaResponse + * + * @throws ApiException if the remote call fails + */ + public function validateSchema($parent, $schema, array $optionalArgs = []) + { + $request = new ValidateSchemaRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setSchema($schema); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ValidateSchema', ValidateSchemaResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $schemaServiceClient = new SchemaServiceClient(); + * try { + * $resource = 'resource'; + * $response = $schemaServiceClient->getIamPolicy($resource); + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $schemaServiceClient = new SchemaServiceClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $schemaServiceClient->setIamPolicy($resource, $policy); + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * 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. + * + * Sample code: + * ``` + * $schemaServiceClient = new SchemaServiceClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $schemaServiceClient->testIamPermissions($resource, $permissions); + * } finally { + * $schemaServiceClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } +} diff --git a/owl-bot-staging/PubSub/v1/src/V1/Gapic/SubscriberGapicClient.php b/owl-bot-staging/PubSub/v1/src/V1/Gapic/SubscriberGapicClient.php new file mode 100644 index 000000000000..1eeff518c582 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/Gapic/SubscriberGapicClient.php @@ -0,0 +1,1664 @@ +subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + * $ackIds = []; + * $subscriberClient->acknowledge($formattedSubscription, $ackIds); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\PubSub\V1\Client\SubscriberClient}. + */ +class SubscriberGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.pubsub.v1.Subscriber'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'pubsub.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'pubsub.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/pubsub', + ]; + + private static $deletedTopicNameTemplate; + + private static $projectNameTemplate; + + private static $projectTopicNameTemplate; + + private static $snapshotNameTemplate; + + private static $subscriptionNameTemplate; + + private static $topicNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/subscriber_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/subscriber_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/subscriber_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/subscriber_rest_client_config.php', + ], + ], + ]; + } + + private static function getDeletedTopicNameTemplate() + { + if (self::$deletedTopicNameTemplate == null) { + self::$deletedTopicNameTemplate = new PathTemplate('_deleted-topic_'); + } + + return self::$deletedTopicNameTemplate; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getProjectTopicNameTemplate() + { + if (self::$projectTopicNameTemplate == null) { + self::$projectTopicNameTemplate = new PathTemplate('projects/{project}/topics/{topic}'); + } + + return self::$projectTopicNameTemplate; + } + + private static function getSnapshotNameTemplate() + { + if (self::$snapshotNameTemplate == null) { + self::$snapshotNameTemplate = new PathTemplate('projects/{project}/snapshots/{snapshot}'); + } + + return self::$snapshotNameTemplate; + } + + private static function getSubscriptionNameTemplate() + { + if (self::$subscriptionNameTemplate == null) { + self::$subscriptionNameTemplate = new PathTemplate('projects/{project}/subscriptions/{subscription}'); + } + + return self::$subscriptionNameTemplate; + } + + private static function getTopicNameTemplate() + { + if (self::$topicNameTemplate == null) { + self::$topicNameTemplate = new PathTemplate('projects/{project}/topics/{topic}'); + } + + return self::$topicNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'deletedTopic' => self::getDeletedTopicNameTemplate(), + 'project' => self::getProjectNameTemplate(), + 'projectTopic' => self::getProjectTopicNameTemplate(), + 'snapshot' => self::getSnapshotNameTemplate(), + 'subscription' => self::getSubscriptionNameTemplate(), + 'topic' => self::getTopicNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * _deleted-topic_ resource. + * + * @return string The formatted _deleted-topic_ resource. + */ + public static function deletedTopicName() + { + return self::getDeletedTopicNameTemplate()->render([]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_topic resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted project_topic resource. + */ + public static function projectTopicName($project, $topic) + { + return self::getProjectTopicNameTemplate()->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a snapshot + * resource. + * + * @param string $project + * @param string $snapshot + * + * @return string The formatted snapshot resource. + */ + public static function snapshotName($project, $snapshot) + { + return self::getSnapshotNameTemplate()->render([ + 'project' => $project, + 'snapshot' => $snapshot, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a subscription + * resource. + * + * @param string $project + * @param string $subscription + * + * @return string The formatted subscription resource. + */ + public static function subscriptionName($project, $subscription) + { + return self::getSubscriptionNameTemplate()->render([ + 'project' => $project, + 'subscription' => $subscription, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a topic + * resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted topic resource. + */ + public static function topicName($project, $topic) + { + return self::getTopicNameTemplate()->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - deletedTopic: _deleted-topic_ + * - project: projects/{project} + * - projectTopic: projects/{project}/topics/{topic} + * - snapshot: projects/{project}/snapshots/{snapshot} + * - subscription: projects/{project}/subscriptions/{subscription} + * - topic: projects/{project}/topics/{topic} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'pubsub.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Acknowledges the messages associated with the `ack_ids` in the + * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages + * from the subscription. + * + * Acknowledging a message whose ack deadline has expired may succeed, + * but such a message may be redelivered later. Acknowledging a message more + * than once will not result in an error. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + * $ackIds = []; + * $subscriberClient->acknowledge($formattedSubscription, $ackIds); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $subscription Required. The subscription whose message is being acknowledged. + * Format is `projects/{project}/subscriptions/{sub}`. + * @param string[] $ackIds Required. The acknowledgment ID for the messages being acknowledged that + * was returned by the Pub/Sub system in the `Pull` response. Must not be + * empty. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function acknowledge($subscription, $ackIds, array $optionalArgs = []) + { + $request = new AcknowledgeRequest(); + $requestParamHeaders = []; + $request->setSubscription($subscription); + $request->setAckIds($ackIds); + $requestParamHeaders['subscription'] = $subscription; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('Acknowledge', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a snapshot from the requested subscription. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, + * which allow you to manage message acknowledgments in bulk. That is, you can + * set the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. + * If the snapshot already exists, returns `ALREADY_EXISTS`. + * If the requested subscription doesn't exist, returns `NOT_FOUND`. + * If the backlog in the subscription is too old -- and the resulting snapshot + * would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. + * See also the `Snapshot.expire_time` field. If the name is not provided in + * the request, the server will assign a random + * name for this snapshot on the same project as the subscription, conforming + * to the [resource name format] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The + * generated name is populated in the returned Snapshot object. Note that for + * REST API requests, you must specify a name in the request. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $formattedName = $subscriberClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + * $response = $subscriberClient->createSnapshot($formattedName, $formattedSubscription); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $name Required. User-provided name for this snapshot. If the name is not provided + * in the request, the server will assign a random name for this snapshot on + * the same project as the subscription. Note that for REST API requests, you + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. + * @param string $subscription Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: + * (a) The existing backlog on the subscription. More precisely, this is + * defined as the messages in the subscription's backlog that are + * unacknowledged upon the successful completion of the + * `CreateSnapshot` request; as well as: + * (b) Any messages published to the subscription's topic following the + * successful completion of the CreateSnapshot request. + * Format is `projects/{project}/subscriptions/{sub}`. + * @param array $optionalArgs { + * Optional. + * + * @type array $labels + * Optional. See [Creating and managing + * labels](https://cloud.google.com/pubsub/docs/labels). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Snapshot + * + * @throws ApiException if the remote call fails + */ + public function createSnapshot($name, $subscription, array $optionalArgs = []) + { + $request = new CreateSnapshotRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setSubscription($subscription); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateSnapshot', Snapshot::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a subscription to a given topic. See the [resource name rules] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * If the subscription already exists, returns `ALREADY_EXISTS`. + * If the corresponding topic doesn't exist, returns `NOT_FOUND`. + * + * If the name is not provided in the request, the server will assign a random + * name for this subscription on the same project as the topic, conforming + * to the [resource name format] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The + * generated name is populated in the returned Subscription object. Note that + * for REST API requests, you must specify a name in the request. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $name = 'name'; + * $formattedTopic = $subscriberClient->topicName('[PROJECT]', '[TOPIC]'); + * $response = $subscriberClient->createSubscription($name, $formattedTopic); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the subscription. It must have the format + * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` 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"`. + * @param string $topic Required. The name of the topic from which this subscription is receiving + * messages. Format is `projects/{project}/topics/{topic}`. The value of this + * field will be `_deleted-topic_` if the topic has been deleted. + * @param array $optionalArgs { + * Optional. + * + * @type PushConfig $pushConfig + * Optional. If push delivery is used with this subscription, this field is + * used to configure it. + * @type BigQueryConfig $bigqueryConfig + * Optional. If delivery to BigQuery is used with this subscription, this + * field is used to configure it. + * @type CloudStorageConfig $cloudStorageConfig + * Optional. If delivery to Google Cloud Storage is used with this + * subscription, this field is used to configure it. + * @type int $ackDeadlineSeconds + * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub + * waits for the subscriber to acknowledge receipt before resending the + * message. In the interval after the message is delivered and before it is + * acknowledged, it is considered to be _outstanding_. During that time + * period, the message will not be redelivered (on a best-effort basis). + * + * For pull subscriptions, this value is used as the initial value for the ack + * deadline. To override this value for a given message, call + * `ModifyAckDeadline` with the corresponding `ack_id` if using + * non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. + * The minimum custom deadline you can specify is 10 seconds. + * The maximum custom deadline you can specify is 600 seconds (10 minutes). + * If this parameter is 0, a default value of 10 seconds is used. + * + * For push delivery, this value is also used to set the request timeout for + * the call to the push endpoint. + * + * If the subscriber never acknowledges the message, the Pub/Sub + * system will eventually redeliver the message. + * @type bool $retainAckedMessages + * Optional. Indicates whether to retain acknowledged messages. If true, then + * messages are not expunged from the subscription's backlog, even if they are + * acknowledged, until they fall out of the `message_retention_duration` + * window. This must be true if you would like to [`Seek` to a timestamp] + * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in + * the past to replay previously-acknowledged messages. + * @type Duration $messageRetentionDuration + * Optional. How long to retain unacknowledged messages in the subscription's + * backlog, from the moment a message is published. If `retain_acked_messages` + * is true, then this also configures the retention of acknowledged messages, + * and thus configures how far back in time a `Seek` can be done. Defaults to + * 7 days. Cannot be more than 7 days or less than 10 minutes. + * @type array $labels + * Optional. See [Creating and managing + * labels](https://cloud.google.com/pubsub/docs/labels). + * @type bool $enableMessageOrdering + * Optional. If true, messages published with the same `ordering_key` in + * `PubsubMessage` will be delivered to the subscribers in the order in which + * they are received by the Pub/Sub system. Otherwise, they may be delivered + * in any order. + * @type ExpirationPolicy $expirationPolicy + * Optional. A policy that specifies the conditions for this subscription's + * expiration. A subscription is considered active as long as any connected + * subscriber is successfully consuming messages from the subscription or is + * issuing operations on the subscription. If `expiration_policy` is not set, + * a *default policy* with `ttl` of 31 days will be used. The minimum allowed + * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set, + * but `expiration_policy.ttl` is not set, the subscription never expires. + * @type string $filter + * Optional. An expression written in the Pub/Sub [filter + * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, + * then only `PubsubMessage`s whose `attributes` field matches the filter are + * delivered on this subscription. If empty, then no messages are filtered + * out. + * @type DeadLetterPolicy $deadLetterPolicy + * Optional. A policy that specifies the conditions for dead lettering + * messages in this subscription. If dead_letter_policy is not set, dead + * lettering is disabled. + * + * The Pub/Sub service account associated with this subscriptions's + * parent project (i.e., + * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have + * permission to Acknowledge() messages on this subscription. + * @type RetryPolicy $retryPolicy + * Optional. A policy that specifies how Pub/Sub retries message delivery for + * this subscription. + * + * If not set, the default retry policy is applied. This generally implies + * that messages will be retried as soon as possible for healthy subscribers. + * RetryPolicy will be triggered on NACKs or acknowledgement deadline + * exceeded events for a given message. + * @type bool $detached + * Optional. Indicates whether the subscription is detached from its topic. + * Detached subscriptions don't receive messages from their topic and don't + * retain any backlog. `Pull` and `StreamingPull` requests will return + * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to + * the endpoint will not be made. + * @type bool $enableExactlyOnceDelivery + * Optional. If true, Pub/Sub provides the following guarantees for the + * delivery of a message with a given value of `message_id` on this + * subscription: + * + * * The message sent to a subscriber is guaranteed not to be resent + * before the message's acknowledgement deadline expires. + * * An acknowledged message will not be resent to a subscriber. + * + * Note that subscribers may still receive multiple copies of a message + * when `enable_exactly_once_delivery` is true if the message was published + * multiple times by a publisher client. These copies are considered distinct + * by Pub/Sub and have distinct `message_id` values. + * @type Duration $topicMessageRetentionDuration + * Output only. Indicates the minimum duration for which a message is retained + * after it is published to the subscription's topic. If this field is set, + * messages published to the subscription's topic in the last + * `topic_message_retention_duration` are always available to subscribers. See + * the `message_retention_duration` field in `Topic`. This field is set only + * in responses from the server; it is ignored if it is set in any requests. + * @type int $state + * Output only. An output-only field indicating whether or not the + * subscription can receive messages. + * For allowed values, use constants defined on {@see \Google\Cloud\PubSub\V1\Subscription\State} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Subscription + * + * @throws ApiException if the remote call fails + */ + public function createSubscription($name, $topic, array $optionalArgs = []) + { + $request = new Subscription(); + $requestParamHeaders = []; + $request->setName($name); + $request->setTopic($topic); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['pushConfig'])) { + $request->setPushConfig($optionalArgs['pushConfig']); + } + + if (isset($optionalArgs['bigqueryConfig'])) { + $request->setBigqueryConfig($optionalArgs['bigqueryConfig']); + } + + if (isset($optionalArgs['cloudStorageConfig'])) { + $request->setCloudStorageConfig($optionalArgs['cloudStorageConfig']); + } + + if (isset($optionalArgs['ackDeadlineSeconds'])) { + $request->setAckDeadlineSeconds($optionalArgs['ackDeadlineSeconds']); + } + + if (isset($optionalArgs['retainAckedMessages'])) { + $request->setRetainAckedMessages($optionalArgs['retainAckedMessages']); + } + + if (isset($optionalArgs['messageRetentionDuration'])) { + $request->setMessageRetentionDuration($optionalArgs['messageRetentionDuration']); + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + if (isset($optionalArgs['enableMessageOrdering'])) { + $request->setEnableMessageOrdering($optionalArgs['enableMessageOrdering']); + } + + if (isset($optionalArgs['expirationPolicy'])) { + $request->setExpirationPolicy($optionalArgs['expirationPolicy']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['deadLetterPolicy'])) { + $request->setDeadLetterPolicy($optionalArgs['deadLetterPolicy']); + } + + if (isset($optionalArgs['retryPolicy'])) { + $request->setRetryPolicy($optionalArgs['retryPolicy']); + } + + if (isset($optionalArgs['detached'])) { + $request->setDetached($optionalArgs['detached']); + } + + if (isset($optionalArgs['enableExactlyOnceDelivery'])) { + $request->setEnableExactlyOnceDelivery($optionalArgs['enableExactlyOnceDelivery']); + } + + if (isset($optionalArgs['topicMessageRetentionDuration'])) { + $request->setTopicMessageRetentionDuration($optionalArgs['topicMessageRetentionDuration']); + } + + if (isset($optionalArgs['state'])) { + $request->setState($optionalArgs['state']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateSubscription', Subscription::class, $optionalArgs, $request)->wait(); + } + + /** + * Removes an existing snapshot. Snapshots are used in [Seek] + * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which + * allow you to manage message acknowledgments in bulk. That is, you can set + * the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. + * When the snapshot is deleted, all messages retained in the snapshot + * are immediately dropped. After a snapshot is deleted, a new one may be + * created with the same name, but the new one has no association with the old + * snapshot or its subscription, unless the same subscription is specified. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $formattedSnapshot = $subscriberClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + * $subscriberClient->deleteSnapshot($formattedSnapshot); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $snapshot Required. The name of the snapshot to delete. + * Format is `projects/{project}/snapshots/{snap}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteSnapshot($snapshot, array $optionalArgs = []) + { + $request = new DeleteSnapshotRequest(); + $requestParamHeaders = []; + $request->setSnapshot($snapshot); + $requestParamHeaders['snapshot'] = $snapshot; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteSnapshot', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes an existing subscription. All messages retained in the subscription + * are immediately dropped. Calls to `Pull` after deletion will return + * `NOT_FOUND`. After a subscription is deleted, a new one may be created with + * the same name, but the new one has no association with the old + * subscription or its topic unless the same topic is specified. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + * $subscriberClient->deleteSubscription($formattedSubscription); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $subscription Required. The subscription to delete. + * Format is `projects/{project}/subscriptions/{sub}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteSubscription($subscription, array $optionalArgs = []) + { + $request = new DeleteSubscriptionRequest(); + $requestParamHeaders = []; + $request->setSubscription($subscription); + $requestParamHeaders['subscription'] = $subscription; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteSubscription', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the configuration details of a snapshot. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, + * which allow you to manage message acknowledgments in bulk. That is, you can + * set the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $formattedSnapshot = $subscriberClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + * $response = $subscriberClient->getSnapshot($formattedSnapshot); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $snapshot Required. The name of the snapshot to get. + * Format is `projects/{project}/snapshots/{snap}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Snapshot + * + * @throws ApiException if the remote call fails + */ + public function getSnapshot($snapshot, array $optionalArgs = []) + { + $request = new GetSnapshotRequest(); + $requestParamHeaders = []; + $request->setSnapshot($snapshot); + $requestParamHeaders['snapshot'] = $snapshot; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSnapshot', Snapshot::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the configuration details of a subscription. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + * $response = $subscriberClient->getSubscription($formattedSubscription); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $subscription Required. The name of the subscription to get. + * Format is `projects/{project}/subscriptions/{sub}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Subscription + * + * @throws ApiException if the remote call fails + */ + public function getSubscription($subscription, array $optionalArgs = []) + { + $request = new GetSubscriptionRequest(); + $requestParamHeaders = []; + $request->setSubscription($subscription); + $requestParamHeaders['subscription'] = $subscription; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSubscription', Subscription::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists the existing snapshots. Snapshots are used in [Seek]( + * https://cloud.google.com/pubsub/docs/replay-overview) operations, which + * allow you to manage message acknowledgments in bulk. That is, you can set + * the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $formattedProject = $subscriberClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $subscriberClient->listSnapshots($formattedProject); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $subscriberClient->listSnapshots($formattedProject); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $project Required. The name of the project in which to list snapshots. + * Format is `projects/{project-id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listSnapshots($project, array $optionalArgs = []) + { + $request = new ListSnapshotsRequest(); + $requestParamHeaders = []; + $request->setProject($project); + $requestParamHeaders['project'] = $project; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListSnapshots', $optionalArgs, ListSnapshotsResponse::class, $request); + } + + /** + * Lists matching subscriptions. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $formattedProject = $subscriberClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $subscriberClient->listSubscriptions($formattedProject); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $subscriberClient->listSubscriptions($formattedProject); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $project Required. The name of the project in which to list subscriptions. + * Format is `projects/{project-id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listSubscriptions($project, array $optionalArgs = []) + { + $request = new ListSubscriptionsRequest(); + $requestParamHeaders = []; + $request->setProject($project); + $requestParamHeaders['project'] = $project; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListSubscriptions', $optionalArgs, ListSubscriptionsResponse::class, $request); + } + + /** + * Modifies the ack deadline for a specific message. This method is useful + * to indicate that more time is needed to process a message by the + * subscriber, or to make the message available for redelivery if the + * processing was interrupted. Note that this does not modify the + * subscription-level `ackDeadlineSeconds` used for subsequent messages. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + * $ackIds = []; + * $ackDeadlineSeconds = 0; + * $subscriberClient->modifyAckDeadline($formattedSubscription, $ackIds, $ackDeadlineSeconds); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $subscription Required. The name of the subscription. + * Format is `projects/{project}/subscriptions/{sub}`. + * @param string[] $ackIds Required. List of acknowledgment IDs. + * @param int $ackDeadlineSeconds Required. The new ack deadline with respect to the time this request was + * sent to the Pub/Sub system. For example, if the value is 10, the new ack + * deadline will expire 10 seconds after the `ModifyAckDeadline` call was + * made. Specifying zero might immediately make the message available for + * delivery to another subscriber client. This typically results in an + * increase in the rate of message redeliveries (that is, duplicates). + * The minimum deadline you can specify is 0 seconds. + * The maximum deadline you can specify in a single request is 600 seconds + * (10 minutes). + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function modifyAckDeadline($subscription, $ackIds, $ackDeadlineSeconds, array $optionalArgs = []) + { + $request = new ModifyAckDeadlineRequest(); + $requestParamHeaders = []; + $request->setSubscription($subscription); + $request->setAckIds($ackIds); + $request->setAckDeadlineSeconds($ackDeadlineSeconds); + $requestParamHeaders['subscription'] = $subscription; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ModifyAckDeadline', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Modifies the `PushConfig` for a specified subscription. + * + * This may be used to change a push subscription to a pull one (signified by + * an empty `PushConfig`) or vice versa, or change the endpoint URL and other + * attributes of a push subscription. Messages will accumulate for delivery + * continuously through the call regardless of changes to the `PushConfig`. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + * $pushConfig = new PushConfig(); + * $subscriberClient->modifyPushConfig($formattedSubscription, $pushConfig); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $subscription Required. The name of the subscription. + * Format is `projects/{project}/subscriptions/{sub}`. + * @param PushConfig $pushConfig Required. The push configuration for future deliveries. + * + * An empty `pushConfig` indicates that the Pub/Sub system should + * stop pushing messages from the given subscription and allow + * messages to be pulled and acknowledged - effectively pausing + * the subscription if `Pull` or `StreamingPull` is not called. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function modifyPushConfig($subscription, $pushConfig, array $optionalArgs = []) + { + $request = new ModifyPushConfigRequest(); + $requestParamHeaders = []; + $request->setSubscription($subscription); + $request->setPushConfig($pushConfig); + $requestParamHeaders['subscription'] = $subscription; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ModifyPushConfig', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Pulls messages from the server. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + * $maxMessages = 0; + * $response = $subscriberClient->pull($formattedSubscription, $maxMessages); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $subscription Required. The subscription from which messages should be pulled. + * Format is `projects/{project}/subscriptions/{sub}`. + * @param int $maxMessages Required. The maximum number of messages to return for this request. Must + * be a positive integer. The Pub/Sub system may return fewer than the number + * specified. + * @param array $optionalArgs { + * Optional. + * + * @type bool $returnImmediately + * Optional. If this field set to true, the system will respond immediately + * even if it there are no messages available to return in the `Pull` + * response. Otherwise, the system may wait (for a bounded amount of time) + * until at least one message is available, rather than returning no messages. + * Warning: setting this field to `true` is discouraged because it adversely + * impacts the performance of `Pull` operations. We recommend that users do + * not set this field. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\PullResponse + * + * @throws ApiException if the remote call fails + */ + public function pull($subscription, $maxMessages, array $optionalArgs = []) + { + $request = new PullRequest(); + $requestParamHeaders = []; + $request->setSubscription($subscription); + $request->setMaxMessages($maxMessages); + $requestParamHeaders['subscription'] = $subscription; + if (isset($optionalArgs['returnImmediately'])) { + $request->setReturnImmediately($optionalArgs['returnImmediately']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('Pull', PullResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Seeks an existing subscription to a point in time or to a given snapshot, + * whichever is provided in the request. Snapshots are used in [Seek] + * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which + * allow you to manage message acknowledgments in bulk. That is, you can set + * the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. Note that both the subscription and the + * snapshot must be on the same topic. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + * $response = $subscriberClient->seek($formattedSubscription); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $subscription Required. The subscription to affect. + * @param array $optionalArgs { + * Optional. + * + * @type Timestamp $time + * Optional. The time to seek to. + * Messages retained in the subscription that were published before this + * time are marked as acknowledged, and messages retained in the + * subscription that were published after this time are marked as + * unacknowledged. Note that this operation affects only those messages + * retained in the subscription (configured by the combination of + * `message_retention_duration` and `retain_acked_messages`). For example, + * if `time` corresponds to a point before the message retention + * window (or to a point before the system's notion of the subscription + * creation time), only retained messages will be marked as unacknowledged, + * and already-expunged messages will not be restored. + * @type string $snapshot + * Optional. The snapshot to seek to. The snapshot's topic must be the same + * as that of the provided subscription. Format is + * `projects/{project}/snapshots/{snap}`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\SeekResponse + * + * @throws ApiException if the remote call fails + */ + public function seek($subscription, array $optionalArgs = []) + { + $request = new SeekRequest(); + $requestParamHeaders = []; + $request->setSubscription($subscription); + $requestParamHeaders['subscription'] = $subscription; + if (isset($optionalArgs['time'])) { + $request->setTime($optionalArgs['time']); + } + + if (isset($optionalArgs['snapshot'])) { + $request->setSnapshot($optionalArgs['snapshot']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('Seek', SeekResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Establishes a stream with the server, which sends messages down to the + * client. The client streams acknowledgements and ack deadline modifications + * back to the server. The server will close the stream and return the status + * on any error. The server may close the stream with status `UNAVAILABLE` to + * reassign server-side resources, in which case, the client should + * re-establish the stream. Flow control can be achieved by configuring the + * underlying RPC channel. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $subscription = 'subscription'; + * $streamAckDeadlineSeconds = 0; + * $request = new StreamingPullRequest(); + * $request->setSubscription($subscription); + * $request->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds); + * // Write all requests to the server, then read all responses until the + * // stream is complete + * $requests = [ + * $request, + * ]; + * $stream = $subscriberClient->streamingPull(); + * $stream->writeAll($requests); + * foreach ($stream->closeWriteAndReadAll() as $element) { + * // doSomethingWith($element); + * } + * // Alternatively: + * // Write requests individually, making read() calls if + * // required. Call closeWrite() once writes are complete, and read the + * // remaining responses from the server. + * $requests = [ + * $request, + * ]; + * $stream = $subscriberClient->streamingPull(); + * foreach ($requests as $request) { + * $stream->write($request); + * // if required, read a single response from the stream + * $element = $stream->read(); + * // doSomethingWith($element) + * } + * $stream->closeWrite(); + * $element = $stream->read(); + * while (!is_null($element)) { + * // doSomethingWith($element) + * $element = $stream->read(); + * } + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return \Google\ApiCore\BidiStream + * + * @throws ApiException if the remote call fails + */ + public function streamingPull(array $optionalArgs = []) + { + return $this->startCall('StreamingPull', StreamingPullResponse::class, $optionalArgs, null, Call::BIDI_STREAMING_CALL); + } + + /** + * Updates an existing snapshot by updating the fields specified in the update + * mask. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, + * which allow you to manage message acknowledgments in bulk. That is, you can + * set the acknowledgment state of messages in an existing subscription to the + * state captured by a snapshot. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $snapshot = new Snapshot(); + * $updateMask = new FieldMask(); + * $response = $subscriberClient->updateSnapshot($snapshot, $updateMask); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param Snapshot $snapshot Required. The updated snapshot object. + * @param FieldMask $updateMask Required. Indicates which fields in the provided snapshot to update. + * Must be specified and non-empty. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Snapshot + * + * @throws ApiException if the remote call fails + */ + public function updateSnapshot($snapshot, $updateMask, array $optionalArgs = []) + { + $request = new UpdateSnapshotRequest(); + $requestParamHeaders = []; + $request->setSnapshot($snapshot); + $request->setUpdateMask($updateMask); + $requestParamHeaders['snapshot.name'] = $snapshot->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateSnapshot', Snapshot::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates an existing subscription by updating the fields specified in the + * update mask. Note that certain properties of a subscription, such as its + * topic, are not modifiable. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $subscription = new Subscription(); + * $updateMask = new FieldMask(); + * $response = $subscriberClient->updateSubscription($subscription, $updateMask); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param Subscription $subscription Required. The updated subscription object. + * @param FieldMask $updateMask Required. Indicates which fields in the provided subscription to update. + * Must be specified and non-empty. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\PubSub\V1\Subscription + * + * @throws ApiException if the remote call fails + */ + public function updateSubscription($subscription, $updateMask, array $optionalArgs = []) + { + $request = new UpdateSubscriptionRequest(); + $requestParamHeaders = []; + $request->setSubscription($subscription); + $request->setUpdateMask($updateMask); + $requestParamHeaders['subscription.name'] = $subscription->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateSubscription', Subscription::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $resource = 'resource'; + * $response = $subscriberClient->getIamPolicy($resource); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $subscriberClient->setIamPolicy($resource, $policy); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * 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. + * + * Sample code: + * ``` + * $subscriberClient = new SubscriberClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $subscriberClient->testIamPermissions($resource, $permissions); + * } finally { + * $subscriberClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } +} diff --git a/owl-bot-staging/PubSub/v1/src/V1/PublisherClient.php b/owl-bot-staging/PubSub/v1/src/V1/PublisherClient.php new file mode 100644 index 000000000000..deefc784c64f --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/PublisherClient.php @@ -0,0 +1,34 @@ + [ + 'google.pubsub.v1.Publisher' => [ + 'CreateTopic' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Topic', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteTopic' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'topic', + 'fieldAccessors' => [ + 'getTopic', + ], + ], + ], + ], + 'DetachSubscription' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\DetachSubscriptionResponse', + 'headerParams' => [ + [ + 'keyName' => 'subscription', + 'fieldAccessors' => [ + 'getSubscription', + ], + ], + ], + ], + 'GetTopic' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Topic', + 'headerParams' => [ + [ + 'keyName' => 'topic', + 'fieldAccessors' => [ + 'getTopic', + ], + ], + ], + ], + 'ListTopicSnapshots' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSnapshots', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\ListTopicSnapshotsResponse', + 'headerParams' => [ + [ + 'keyName' => 'topic', + 'fieldAccessors' => [ + 'getTopic', + ], + ], + ], + ], + 'ListTopicSubscriptions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSubscriptions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\ListTopicSubscriptionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'topic', + 'fieldAccessors' => [ + 'getTopic', + ], + ], + ], + ], + 'ListTopics' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getTopics', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\ListTopicsResponse', + 'headerParams' => [ + [ + 'keyName' => 'project', + 'fieldAccessors' => [ + 'getProject', + ], + ], + ], + ], + 'Publish' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\PublishResponse', + 'headerParams' => [ + [ + 'keyName' => 'topic', + 'fieldAccessors' => [ + 'getTopic', + ], + ], + ], + ], + 'UpdateTopic' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Topic', + 'headerParams' => [ + [ + 'keyName' => 'topic.name', + 'fieldAccessors' => [ + 'getTopic', + 'getName', + ], + ], + ], + ], + 'GetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'templateMap' => [ + 'deletedTopic' => '_deleted-topic_', + 'project' => 'projects/{project}', + 'projectTopic' => 'projects/{project}/topics/{topic}', + 'schema' => 'projects/{project}/schemas/{schema}', + 'subscription' => 'projects/{project}/subscriptions/{subscription}', + 'topic' => 'projects/{project}/topics/{topic}', + ], + ], + ], +]; diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/publisher_rest_client_config.php b/owl-bot-staging/PubSub/v1/src/V1/resources/publisher_rest_client_config.php new file mode 100644 index 000000000000..a62253330e66 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/resources/publisher_rest_client_config.php @@ -0,0 +1,217 @@ + [ + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.pubsub.v1.Publisher' => [ + 'CreateTopic' => [ + 'method' => 'put', + 'uriTemplate' => '/v1/{name=projects/*/topics/*}', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteTopic' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{topic=projects/*/topics/*}', + 'placeholders' => [ + 'topic' => [ + 'getters' => [ + 'getTopic', + ], + ], + ], + ], + 'DetachSubscription' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}:detach', + 'placeholders' => [ + 'subscription' => [ + 'getters' => [ + 'getSubscription', + ], + ], + ], + ], + 'GetTopic' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{topic=projects/*/topics/*}', + 'placeholders' => [ + 'topic' => [ + 'getters' => [ + 'getTopic', + ], + ], + ], + ], + 'ListTopicSnapshots' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{topic=projects/*/topics/*}/snapshots', + 'placeholders' => [ + 'topic' => [ + 'getters' => [ + 'getTopic', + ], + ], + ], + ], + 'ListTopicSubscriptions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{topic=projects/*/topics/*}/subscriptions', + 'placeholders' => [ + 'topic' => [ + 'getters' => [ + 'getTopic', + ], + ], + ], + ], + 'ListTopics' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{project=projects/*}/topics', + 'placeholders' => [ + 'project' => [ + 'getters' => [ + 'getProject', + ], + ], + ], + ], + 'Publish' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{topic=projects/*/topics/*}:publish', + 'body' => '*', + 'placeholders' => [ + 'topic' => [ + 'getters' => [ + 'getTopic', + ], + ], + ], + ], + 'UpdateTopic' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{topic.name=projects/*/topics/*}', + 'body' => '*', + 'placeholders' => [ + 'topic.name' => [ + 'getters' => [ + 'getTopic', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_client_config.json b/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_client_config.json new file mode 100644 index 000000000000..2773e2ae2d5e --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_client_config.json @@ -0,0 +1,99 @@ +{ + "interfaces": { + "google.pubsub.v1.SchemaService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_8_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_8_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CommitSchema": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_8_codes", + "retry_params_name": "retry_policy_8_params" + }, + "CreateSchema": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_8_codes", + "retry_params_name": "retry_policy_8_params" + }, + "DeleteSchema": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_8_codes", + "retry_params_name": "retry_policy_8_params" + }, + "DeleteSchemaRevision": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_8_codes", + "retry_params_name": "retry_policy_8_params" + }, + "GetSchema": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_8_codes", + "retry_params_name": "retry_policy_8_params" + }, + "ListSchemaRevisions": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_8_codes", + "retry_params_name": "retry_policy_8_params" + }, + "ListSchemas": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_8_codes", + "retry_params_name": "retry_policy_8_params" + }, + "RollbackSchema": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_8_codes", + "retry_params_name": "retry_policy_8_params" + }, + "ValidateMessage": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_8_codes", + "retry_params_name": "retry_policy_8_params" + }, + "ValidateSchema": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_8_codes", + "retry_params_name": "retry_policy_8_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_descriptor_config.php b/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_descriptor_config.php new file mode 100644 index 000000000000..f11afb7e2cf1 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_descriptor_config.php @@ -0,0 +1,207 @@ + [ + 'google.pubsub.v1.SchemaService' => [ + 'CommitSchema' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Schema', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CreateSchema' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Schema', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteSchema' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteSchemaRevision' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Schema', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetSchema' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Schema', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListSchemaRevisions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSchemas', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\ListSchemaRevisionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListSchemas' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSchemas', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\ListSchemasResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'RollbackSchema' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Schema', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ValidateMessage' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\ValidateMessageResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ValidateSchema' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\ValidateSchemaResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'templateMap' => [ + 'project' => 'projects/{project}', + 'schema' => 'projects/{project}/schemas/{schema}', + ], + ], + ], +]; diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_rest_client_config.php b/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_rest_client_config.php new file mode 100644 index 000000000000..db359582076c --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_rest_client_config.php @@ -0,0 +1,229 @@ + [ + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.pubsub.v1.SchemaService' => [ + 'CommitSchema' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/schemas/*}:commit', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateSchema' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/schemas', + 'body' => 'schema', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteSchema' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/schemas/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteSchemaRevision' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/schemas/*}:deleteRevision', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetSchema' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/schemas/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListSchemaRevisions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/schemas/*}:listRevisions', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListSchemas' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*}/schemas', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'RollbackSchema' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/schemas/*}:rollback', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ValidateMessage' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/schemas:validateMessage', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ValidateSchema' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/schemas:validate', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_client_config.json b/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_client_config.json new file mode 100644 index 000000000000..c4812e9de3f8 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_client_config.json @@ -0,0 +1,172 @@ +{ + "interfaces": { + "google.pubsub.v1.Subscriber": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_4_codes": [ + "DEADLINE_EXCEEDED", + "RESOURCE_EXHAUSTED", + "ABORTED", + "INTERNAL", + "UNAVAILABLE" + ], + "retry_policy_5_codes": [ + "UNKNOWN", + "ABORTED", + "UNAVAILABLE", + "INTERNAL" + ], + "retry_policy_6_codes": [ + "UNKNOWN", + "ABORTED", + "UNAVAILABLE" + ], + "retry_policy_7_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_4_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 4.0, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 900000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 900000, + "total_timeout_millis": 900000 + }, + "retry_policy_5_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + }, + "retry_policy_6_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + }, + "retry_policy_7_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "Acknowledge": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "CreateSnapshot": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "CreateSubscription": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_6_codes", + "retry_params_name": "retry_policy_6_params" + }, + "DeleteSnapshot": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "DeleteSubscription": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "GetSnapshot": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_6_codes", + "retry_params_name": "retry_policy_6_params" + }, + "GetSubscription": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_6_codes", + "retry_params_name": "retry_policy_6_params" + }, + "ListSnapshots": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_6_codes", + "retry_params_name": "retry_policy_6_params" + }, + "ListSubscriptions": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_6_codes", + "retry_params_name": "retry_policy_6_params" + }, + "ModifyAckDeadline": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "ModifyPushConfig": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "Pull": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_5_codes", + "retry_params_name": "retry_policy_5_params" + }, + "Seek": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_6_codes", + "retry_params_name": "retry_policy_6_params" + }, + "StreamingPull": { + "timeout_millis": 900000 + }, + "UpdateSnapshot": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "UpdateSubscription": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_6_codes", + "retry_params_name": "retry_policy_6_params" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + } + } + } + } +} diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_descriptor_config.php b/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_descriptor_config.php new file mode 100644 index 000000000000..4b0fead59008 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_descriptor_config.php @@ -0,0 +1,280 @@ + [ + 'google.pubsub.v1.Subscriber' => [ + 'Acknowledge' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'subscription', + 'fieldAccessors' => [ + 'getSubscription', + ], + ], + ], + ], + 'CreateSnapshot' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Snapshot', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CreateSubscription' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Subscription', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteSnapshot' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'snapshot', + 'fieldAccessors' => [ + 'getSnapshot', + ], + ], + ], + ], + 'DeleteSubscription' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'subscription', + 'fieldAccessors' => [ + 'getSubscription', + ], + ], + ], + ], + 'GetSnapshot' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Snapshot', + 'headerParams' => [ + [ + 'keyName' => 'snapshot', + 'fieldAccessors' => [ + 'getSnapshot', + ], + ], + ], + ], + 'GetSubscription' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Subscription', + 'headerParams' => [ + [ + 'keyName' => 'subscription', + 'fieldAccessors' => [ + 'getSubscription', + ], + ], + ], + ], + 'ListSnapshots' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSnapshots', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\ListSnapshotsResponse', + 'headerParams' => [ + [ + 'keyName' => 'project', + 'fieldAccessors' => [ + 'getProject', + ], + ], + ], + ], + 'ListSubscriptions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSubscriptions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\ListSubscriptionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'project', + 'fieldAccessors' => [ + 'getProject', + ], + ], + ], + ], + 'ModifyAckDeadline' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'subscription', + 'fieldAccessors' => [ + 'getSubscription', + ], + ], + ], + ], + 'ModifyPushConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'subscription', + 'fieldAccessors' => [ + 'getSubscription', + ], + ], + ], + ], + 'Pull' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\PullResponse', + 'headerParams' => [ + [ + 'keyName' => 'subscription', + 'fieldAccessors' => [ + 'getSubscription', + ], + ], + ], + ], + 'Seek' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\SeekResponse', + 'headerParams' => [ + [ + 'keyName' => 'subscription', + 'fieldAccessors' => [ + 'getSubscription', + ], + ], + ], + ], + 'StreamingPull' => [ + 'grpcStreaming' => [ + 'grpcStreamingType' => 'BidiStreaming', + ], + 'callType' => \Google\ApiCore\Call::BIDI_STREAMING_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\StreamingPullResponse', + ], + 'UpdateSnapshot' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Snapshot', + 'headerParams' => [ + [ + 'keyName' => 'snapshot.name', + 'fieldAccessors' => [ + 'getSnapshot', + 'getName', + ], + ], + ], + ], + 'UpdateSubscription' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\PubSub\V1\Subscription', + 'headerParams' => [ + [ + 'keyName' => 'subscription.name', + 'fieldAccessors' => [ + 'getSubscription', + 'getName', + ], + ], + ], + ], + 'GetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'templateMap' => [ + 'deletedTopic' => '_deleted-topic_', + 'project' => 'projects/{project}', + 'projectTopic' => 'projects/{project}/topics/{topic}', + 'snapshot' => 'projects/{project}/snapshots/{snapshot}', + 'subscription' => 'projects/{project}/subscriptions/{subscription}', + 'topic' => 'projects/{project}/topics/{topic}', + ], + ], + ], +]; diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_rest_client_config.php b/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_rest_client_config.php new file mode 100644 index 000000000000..e39849a42744 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_rest_client_config.php @@ -0,0 +1,290 @@ + [ + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.pubsub.v1.Subscriber' => [ + 'Acknowledge' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}:acknowledge', + 'body' => '*', + 'placeholders' => [ + 'subscription' => [ + 'getters' => [ + 'getSubscription', + ], + ], + ], + ], + 'CreateSnapshot' => [ + 'method' => 'put', + 'uriTemplate' => '/v1/{name=projects/*/snapshots/*}', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateSubscription' => [ + 'method' => 'put', + 'uriTemplate' => '/v1/{name=projects/*/subscriptions/*}', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteSnapshot' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{snapshot=projects/*/snapshots/*}', + 'placeholders' => [ + 'snapshot' => [ + 'getters' => [ + 'getSnapshot', + ], + ], + ], + ], + 'DeleteSubscription' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}', + 'placeholders' => [ + 'subscription' => [ + 'getters' => [ + 'getSubscription', + ], + ], + ], + ], + 'GetSnapshot' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{snapshot=projects/*/snapshots/*}', + 'placeholders' => [ + 'snapshot' => [ + 'getters' => [ + 'getSnapshot', + ], + ], + ], + ], + 'GetSubscription' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}', + 'placeholders' => [ + 'subscription' => [ + 'getters' => [ + 'getSubscription', + ], + ], + ], + ], + 'ListSnapshots' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{project=projects/*}/snapshots', + 'placeholders' => [ + 'project' => [ + 'getters' => [ + 'getProject', + ], + ], + ], + ], + 'ListSubscriptions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{project=projects/*}/subscriptions', + 'placeholders' => [ + 'project' => [ + 'getters' => [ + 'getProject', + ], + ], + ], + ], + 'ModifyAckDeadline' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline', + 'body' => '*', + 'placeholders' => [ + 'subscription' => [ + 'getters' => [ + 'getSubscription', + ], + ], + ], + ], + 'ModifyPushConfig' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig', + 'body' => '*', + 'placeholders' => [ + 'subscription' => [ + 'getters' => [ + 'getSubscription', + ], + ], + ], + ], + 'Pull' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}:pull', + 'body' => '*', + 'placeholders' => [ + 'subscription' => [ + 'getters' => [ + 'getSubscription', + ], + ], + ], + ], + 'Seek' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}:seek', + 'body' => '*', + 'placeholders' => [ + 'subscription' => [ + 'getters' => [ + 'getSubscription', + ], + ], + ], + ], + 'UpdateSnapshot' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{snapshot.name=projects/*/snapshots/*}', + 'body' => '*', + 'placeholders' => [ + 'snapshot.name' => [ + 'getters' => [ + 'getSnapshot', + 'getName', + ], + ], + ], + ], + 'UpdateSubscription' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{subscription.name=projects/*/subscriptions/*}', + 'body' => '*', + 'placeholders' => [ + 'subscription.name' => [ + 'getters' => [ + 'getSubscription', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/PublisherClientTest.php b/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/PublisherClientTest.php new file mode 100644 index 000000000000..a14d598012b9 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/PublisherClientTest.php @@ -0,0 +1,941 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return PublisherClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new PublisherClient($options); + } + + /** @test */ + public function createTopicTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $kmsKeyName2 = 'kmsKeyName2-1057489140'; + $satisfiesPzs2 = true; + $expectedResponse = new Topic(); + $expectedResponse->setName($name2); + $expectedResponse->setKmsKeyName($kmsKeyName2); + $expectedResponse->setSatisfiesPzs($satisfiesPzs2); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $request = (new Topic()) + ->setName($name); + $response = $gapicClient->createTopic($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/CreateTopic', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createTopicExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $request = (new Topic()) + ->setName($name); + try { + $gapicClient->createTopic($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteTopicTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $request = (new DeleteTopicRequest()) + ->setTopic($formattedTopic); + $gapicClient->deleteTopic($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/DeleteTopic', $actualFuncCall); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($formattedTopic, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteTopicExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $request = (new DeleteTopicRequest()) + ->setTopic($formattedTopic); + try { + $gapicClient->deleteTopic($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function detachSubscriptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new DetachSubscriptionResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $request = (new DetachSubscriptionRequest()) + ->setSubscription($formattedSubscription); + $response = $gapicClient->detachSubscription($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/DetachSubscription', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function detachSubscriptionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $request = (new DetachSubscriptionRequest()) + ->setSubscription($formattedSubscription); + try { + $gapicClient->detachSubscription($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getTopicTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; + $expectedResponse = new Topic(); + $expectedResponse->setName($name); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $request = (new GetTopicRequest()) + ->setTopic($formattedTopic); + $response = $gapicClient->getTopic($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/GetTopic', $actualFuncCall); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($formattedTopic, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getTopicExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $request = (new GetTopicRequest()) + ->setTopic($formattedTopic); + try { + $gapicClient->getTopic($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTopicSnapshotsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $snapshotsElement = 'snapshotsElement1339034092'; + $snapshots = [ + $snapshotsElement, + ]; + $expectedResponse = new ListTopicSnapshotsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSnapshots($snapshots); + $transport->addResponse($expectedResponse); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $request = (new ListTopicSnapshotsRequest()) + ->setTopic($formattedTopic); + $response = $gapicClient->listTopicSnapshots($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSnapshots()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/ListTopicSnapshots', $actualFuncCall); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($formattedTopic, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTopicSnapshotsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $request = (new ListTopicSnapshotsRequest()) + ->setTopic($formattedTopic); + try { + $gapicClient->listTopicSnapshots($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTopicSubscriptionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $subscriptionsElement = 'subscriptionsElement1698708147'; + $subscriptions = [ + $subscriptionsElement, + ]; + $expectedResponse = new ListTopicSubscriptionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSubscriptions($subscriptions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $request = (new ListTopicSubscriptionsRequest()) + ->setTopic($formattedTopic); + $response = $gapicClient->listTopicSubscriptions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSubscriptions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/ListTopicSubscriptions', $actualFuncCall); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($formattedTopic, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTopicSubscriptionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $request = (new ListTopicSubscriptionsRequest()) + ->setTopic($formattedTopic); + try { + $gapicClient->listTopicSubscriptions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTopicsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $topicsElement = new Topic(); + $topics = [ + $topicsElement, + ]; + $expectedResponse = new ListTopicsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTopics($topics); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProject = $gapicClient->projectName('[PROJECT]'); + $request = (new ListTopicsRequest()) + ->setProject($formattedProject); + $response = $gapicClient->listTopics($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTopics()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/ListTopics', $actualFuncCall); + $actualValue = $actualRequestObject->getProject(); + $this->assertProtobufEquals($formattedProject, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTopicsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedProject = $gapicClient->projectName('[PROJECT]'); + $request = (new ListTopicsRequest()) + ->setProject($formattedProject); + try { + $gapicClient->listTopics($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function publishTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new PublishResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $messages = []; + $request = (new PublishRequest()) + ->setTopic($formattedTopic) + ->setMessages($messages); + $response = $gapicClient->publish($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/Publish', $actualFuncCall); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($formattedTopic, $actualValue); + $actualValue = $actualRequestObject->getMessages(); + $this->assertProtobufEquals($messages, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function publishExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $messages = []; + $request = (new PublishRequest()) + ->setTopic($formattedTopic) + ->setMessages($messages); + try { + $gapicClient->publish($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateTopicTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; + $expectedResponse = new Topic(); + $expectedResponse->setName($name); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); + $transport->addResponse($expectedResponse); + // Mock request + $topic = new Topic(); + $topicName = 'topicName388205658'; + $topic->setName($topicName); + $updateMask = new FieldMask(); + $request = (new UpdateTopicRequest()) + ->setTopic($topic) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateTopic($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/UpdateTopic', $actualFuncCall); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($topic, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateTopicExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $topic = new Topic(); + $topicName = 'topicName388205658'; + $topic->setName($topicName); + $updateMask = new FieldMask(); + $request = (new UpdateTopicRequest()) + ->setTopic($topic) + ->setUpdateMask($updateMask); + try { + $gapicClient->updateTopic($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + $response = $gapicClient->getIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + try { + $gapicClient->getIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + $response = $gapicClient->setIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + try { + $gapicClient->setIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + $response = $gapicClient->testIamPermissions($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + try { + $gapicClient->testIamPermissions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createTopicAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $kmsKeyName2 = 'kmsKeyName2-1057489140'; + $satisfiesPzs2 = true; + $expectedResponse = new Topic(); + $expectedResponse->setName($name2); + $expectedResponse->setKmsKeyName($kmsKeyName2); + $expectedResponse->setSatisfiesPzs($satisfiesPzs2); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $request = (new Topic()) + ->setName($name); + $response = $gapicClient->createTopicAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/CreateTopic', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SchemaServiceClientTest.php b/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SchemaServiceClientTest.php new file mode 100644 index 000000000000..cb6a7fbd7218 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SchemaServiceClientTest.php @@ -0,0 +1,1037 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return SchemaServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new SchemaServiceClient($options); + } + + /** @test */ + public function commitSchemaTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $definition = 'definition-1014418093'; + $revisionId = 'revisionId513861631'; + $expectedResponse = new Schema(); + $expectedResponse->setName($name2); + $expectedResponse->setDefinition($definition); + $expectedResponse->setRevisionId($revisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $schema = new Schema(); + $schemaName = 'schemaName-448762932'; + $schema->setName($schemaName); + $request = (new CommitSchemaRequest()) + ->setName($formattedName) + ->setSchema($schema); + $response = $gapicClient->commitSchema($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/CommitSchema', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getSchema(); + $this->assertProtobufEquals($schema, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function commitSchemaExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $schema = new Schema(); + $schemaName = 'schemaName-448762932'; + $schema->setName($schemaName); + $request = (new CommitSchemaRequest()) + ->setName($formattedName) + ->setSchema($schema); + try { + $gapicClient->commitSchema($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSchemaTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $definition = 'definition-1014418093'; + $revisionId = 'revisionId513861631'; + $expectedResponse = new Schema(); + $expectedResponse->setName($name); + $expectedResponse->setDefinition($definition); + $expectedResponse->setRevisionId($revisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $schema = new Schema(); + $schemaName = 'schemaName-448762932'; + $schema->setName($schemaName); + $request = (new CreateSchemaRequest()) + ->setParent($formattedParent) + ->setSchema($schema); + $response = $gapicClient->createSchema($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/CreateSchema', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getSchema(); + $this->assertProtobufEquals($schema, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSchemaExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $schema = new Schema(); + $schemaName = 'schemaName-448762932'; + $schema->setName($schemaName); + $request = (new CreateSchemaRequest()) + ->setParent($formattedParent) + ->setSchema($schema); + try { + $gapicClient->createSchema($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSchemaTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $request = (new DeleteSchemaRequest()) + ->setName($formattedName); + $gapicClient->deleteSchema($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/DeleteSchema', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSchemaExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $request = (new DeleteSchemaRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteSchema($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSchemaRevisionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $definition = 'definition-1014418093'; + $revisionId2 = 'revisionId2-100208654'; + $expectedResponse = new Schema(); + $expectedResponse->setName($name2); + $expectedResponse->setDefinition($definition); + $expectedResponse->setRevisionId($revisionId2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $revisionId = 'revisionId513861631'; + $request = (new DeleteSchemaRevisionRequest()) + ->setName($formattedName) + ->setRevisionId($revisionId); + $response = $gapicClient->deleteSchemaRevision($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/DeleteSchemaRevision', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getRevisionId(); + $this->assertProtobufEquals($revisionId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSchemaRevisionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $revisionId = 'revisionId513861631'; + $request = (new DeleteSchemaRevisionRequest()) + ->setName($formattedName) + ->setRevisionId($revisionId); + try { + $gapicClient->deleteSchemaRevision($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSchemaTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $definition = 'definition-1014418093'; + $revisionId = 'revisionId513861631'; + $expectedResponse = new Schema(); + $expectedResponse->setName($name2); + $expectedResponse->setDefinition($definition); + $expectedResponse->setRevisionId($revisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $request = (new GetSchemaRequest()) + ->setName($formattedName); + $response = $gapicClient->getSchema($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/GetSchema', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSchemaExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $request = (new GetSchemaRequest()) + ->setName($formattedName); + try { + $gapicClient->getSchema($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSchemaRevisionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $schemasElement = new Schema(); + $schemas = [ + $schemasElement, + ]; + $expectedResponse = new ListSchemaRevisionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSchemas($schemas); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $request = (new ListSchemaRevisionsRequest()) + ->setName($formattedName); + $response = $gapicClient->listSchemaRevisions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSchemas()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/ListSchemaRevisions', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSchemaRevisionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $request = (new ListSchemaRevisionsRequest()) + ->setName($formattedName); + try { + $gapicClient->listSchemaRevisions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSchemasTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $schemasElement = new Schema(); + $schemas = [ + $schemasElement, + ]; + $expectedResponse = new ListSchemasResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSchemas($schemas); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListSchemasRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listSchemas($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSchemas()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/ListSchemas', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSchemasExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListSchemasRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listSchemas($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function rollbackSchemaTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $definition = 'definition-1014418093'; + $revisionId2 = 'revisionId2-100208654'; + $expectedResponse = new Schema(); + $expectedResponse->setName($name2); + $expectedResponse->setDefinition($definition); + $expectedResponse->setRevisionId($revisionId2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $revisionId = 'revisionId513861631'; + $request = (new RollbackSchemaRequest()) + ->setName($formattedName) + ->setRevisionId($revisionId); + $response = $gapicClient->rollbackSchema($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/RollbackSchema', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getRevisionId(); + $this->assertProtobufEquals($revisionId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function rollbackSchemaExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $revisionId = 'revisionId513861631'; + $request = (new RollbackSchemaRequest()) + ->setName($formattedName) + ->setRevisionId($revisionId); + try { + $gapicClient->rollbackSchema($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function validateMessageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ValidateMessageResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ValidateMessageRequest()) + ->setParent($formattedParent); + $response = $gapicClient->validateMessage($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/ValidateMessage', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function validateMessageExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ValidateMessageRequest()) + ->setParent($formattedParent); + try { + $gapicClient->validateMessage($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function validateSchemaTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ValidateSchemaResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $schema = new Schema(); + $schemaName = 'schemaName-448762932'; + $schema->setName($schemaName); + $request = (new ValidateSchemaRequest()) + ->setParent($formattedParent) + ->setSchema($schema); + $response = $gapicClient->validateSchema($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/ValidateSchema', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getSchema(); + $this->assertProtobufEquals($schema, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function validateSchemaExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $schema = new Schema(); + $schemaName = 'schemaName-448762932'; + $schema->setName($schemaName); + $request = (new ValidateSchemaRequest()) + ->setParent($formattedParent) + ->setSchema($schema); + try { + $gapicClient->validateSchema($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + $response = $gapicClient->getIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + try { + $gapicClient->getIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + $response = $gapicClient->setIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + try { + $gapicClient->setIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + $response = $gapicClient->testIamPermissions($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + try { + $gapicClient->testIamPermissions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function commitSchemaAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $definition = 'definition-1014418093'; + $revisionId = 'revisionId513861631'; + $expectedResponse = new Schema(); + $expectedResponse->setName($name2); + $expectedResponse->setDefinition($definition); + $expectedResponse->setRevisionId($revisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $schema = new Schema(); + $schemaName = 'schemaName-448762932'; + $schema->setName($schemaName); + $request = (new CommitSchemaRequest()) + ->setName($formattedName) + ->setSchema($schema); + $response = $gapicClient->commitSchemaAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/CommitSchema', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getSchema(); + $this->assertProtobufEquals($schema, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SubscriberClientTest.php b/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SubscriberClientTest.php new file mode 100644 index 000000000000..cb8d2dee95a0 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SubscriberClientTest.php @@ -0,0 +1,1494 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return SubscriberClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new SubscriberClient($options); + } + + /** @test */ + public function acknowledgeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $ackIds = []; + $request = (new AcknowledgeRequest()) + ->setSubscription($formattedSubscription) + ->setAckIds($ackIds); + $gapicClient->acknowledge($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/Acknowledge', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $actualValue = $actualRequestObject->getAckIds(); + $this->assertProtobufEquals($ackIds, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function acknowledgeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $ackIds = []; + $request = (new AcknowledgeRequest()) + ->setSubscription($formattedSubscription) + ->setAckIds($ackIds); + try { + $gapicClient->acknowledge($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSnapshotTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $topic = 'topic110546223'; + $expectedResponse = new Snapshot(); + $expectedResponse->setName($name2); + $expectedResponse->setTopic($topic); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $request = (new CreateSnapshotRequest()) + ->setName($formattedName) + ->setSubscription($formattedSubscription); + $response = $gapicClient->createSnapshot($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/CreateSnapshot', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSnapshotExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $request = (new CreateSnapshotRequest()) + ->setName($formattedName) + ->setSubscription($formattedSubscription); + try { + $gapicClient->createSnapshot($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSubscriptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $topic2 = 'topic2-1139259102'; + $ackDeadlineSeconds2 = 921632575; + $retainAckedMessages2 = true; + $enableMessageOrdering2 = false; + $filter2 = 'filter2-721168085'; + $detached2 = false; + $enableExactlyOnceDelivery2 = true; + $expectedResponse = new Subscription(); + $expectedResponse->setName($name2); + $expectedResponse->setTopic($topic2); + $expectedResponse->setAckDeadlineSeconds($ackDeadlineSeconds2); + $expectedResponse->setRetainAckedMessages($retainAckedMessages2); + $expectedResponse->setEnableMessageOrdering($enableMessageOrdering2); + $expectedResponse->setFilter($filter2); + $expectedResponse->setDetached($detached2); + $expectedResponse->setEnableExactlyOnceDelivery($enableExactlyOnceDelivery2); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $request = (new Subscription()) + ->setName($name) + ->setTopic($formattedTopic); + $response = $gapicClient->createSubscription($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/CreateSubscription', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($formattedTopic, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSubscriptionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $request = (new Subscription()) + ->setName($name) + ->setTopic($formattedTopic); + try { + $gapicClient->createSubscription($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSnapshotTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + $request = (new DeleteSnapshotRequest()) + ->setSnapshot($formattedSnapshot); + $gapicClient->deleteSnapshot($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/DeleteSnapshot', $actualFuncCall); + $actualValue = $actualRequestObject->getSnapshot(); + $this->assertProtobufEquals($formattedSnapshot, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSnapshotExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + $request = (new DeleteSnapshotRequest()) + ->setSnapshot($formattedSnapshot); + try { + $gapicClient->deleteSnapshot($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSubscriptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $request = (new DeleteSubscriptionRequest()) + ->setSubscription($formattedSubscription); + $gapicClient->deleteSubscription($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/DeleteSubscription', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSubscriptionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $request = (new DeleteSubscriptionRequest()) + ->setSubscription($formattedSubscription); + try { + $gapicClient->deleteSubscription($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSnapshotTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $topic = 'topic110546223'; + $expectedResponse = new Snapshot(); + $expectedResponse->setName($name); + $expectedResponse->setTopic($topic); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + $request = (new GetSnapshotRequest()) + ->setSnapshot($formattedSnapshot); + $response = $gapicClient->getSnapshot($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/GetSnapshot', $actualFuncCall); + $actualValue = $actualRequestObject->getSnapshot(); + $this->assertProtobufEquals($formattedSnapshot, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSnapshotExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + $request = (new GetSnapshotRequest()) + ->setSnapshot($formattedSnapshot); + try { + $gapicClient->getSnapshot($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSubscriptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $topic = 'topic110546223'; + $ackDeadlineSeconds = 2135351438; + $retainAckedMessages = false; + $enableMessageOrdering = true; + $filter = 'filter-1274492040'; + $detached = true; + $enableExactlyOnceDelivery = false; + $expectedResponse = new Subscription(); + $expectedResponse->setName($name); + $expectedResponse->setTopic($topic); + $expectedResponse->setAckDeadlineSeconds($ackDeadlineSeconds); + $expectedResponse->setRetainAckedMessages($retainAckedMessages); + $expectedResponse->setEnableMessageOrdering($enableMessageOrdering); + $expectedResponse->setFilter($filter); + $expectedResponse->setDetached($detached); + $expectedResponse->setEnableExactlyOnceDelivery($enableExactlyOnceDelivery); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $request = (new GetSubscriptionRequest()) + ->setSubscription($formattedSubscription); + $response = $gapicClient->getSubscription($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/GetSubscription', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSubscriptionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $request = (new GetSubscriptionRequest()) + ->setSubscription($formattedSubscription); + try { + $gapicClient->getSubscription($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSnapshotsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $snapshotsElement = new Snapshot(); + $snapshots = [ + $snapshotsElement, + ]; + $expectedResponse = new ListSnapshotsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSnapshots($snapshots); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProject = $gapicClient->projectName('[PROJECT]'); + $request = (new ListSnapshotsRequest()) + ->setProject($formattedProject); + $response = $gapicClient->listSnapshots($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSnapshots()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/ListSnapshots', $actualFuncCall); + $actualValue = $actualRequestObject->getProject(); + $this->assertProtobufEquals($formattedProject, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSnapshotsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedProject = $gapicClient->projectName('[PROJECT]'); + $request = (new ListSnapshotsRequest()) + ->setProject($formattedProject); + try { + $gapicClient->listSnapshots($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSubscriptionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $subscriptionsElement = new Subscription(); + $subscriptions = [ + $subscriptionsElement, + ]; + $expectedResponse = new ListSubscriptionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSubscriptions($subscriptions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProject = $gapicClient->projectName('[PROJECT]'); + $request = (new ListSubscriptionsRequest()) + ->setProject($formattedProject); + $response = $gapicClient->listSubscriptions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSubscriptions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/ListSubscriptions', $actualFuncCall); + $actualValue = $actualRequestObject->getProject(); + $this->assertProtobufEquals($formattedProject, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSubscriptionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedProject = $gapicClient->projectName('[PROJECT]'); + $request = (new ListSubscriptionsRequest()) + ->setProject($formattedProject); + try { + $gapicClient->listSubscriptions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function modifyAckDeadlineTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $ackIds = []; + $ackDeadlineSeconds = 2135351438; + $request = (new ModifyAckDeadlineRequest()) + ->setSubscription($formattedSubscription) + ->setAckIds($ackIds) + ->setAckDeadlineSeconds($ackDeadlineSeconds); + $gapicClient->modifyAckDeadline($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/ModifyAckDeadline', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $actualValue = $actualRequestObject->getAckIds(); + $this->assertProtobufEquals($ackIds, $actualValue); + $actualValue = $actualRequestObject->getAckDeadlineSeconds(); + $this->assertProtobufEquals($ackDeadlineSeconds, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function modifyAckDeadlineExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $ackIds = []; + $ackDeadlineSeconds = 2135351438; + $request = (new ModifyAckDeadlineRequest()) + ->setSubscription($formattedSubscription) + ->setAckIds($ackIds) + ->setAckDeadlineSeconds($ackDeadlineSeconds); + try { + $gapicClient->modifyAckDeadline($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function modifyPushConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $pushConfig = new PushConfig(); + $request = (new ModifyPushConfigRequest()) + ->setSubscription($formattedSubscription) + ->setPushConfig($pushConfig); + $gapicClient->modifyPushConfig($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/ModifyPushConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $actualValue = $actualRequestObject->getPushConfig(); + $this->assertProtobufEquals($pushConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function modifyPushConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $pushConfig = new PushConfig(); + $request = (new ModifyPushConfigRequest()) + ->setSubscription($formattedSubscription) + ->setPushConfig($pushConfig); + try { + $gapicClient->modifyPushConfig($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function pullTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new PullResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $maxMessages = 496131527; + $request = (new PullRequest()) + ->setSubscription($formattedSubscription) + ->setMaxMessages($maxMessages); + $response = $gapicClient->pull($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/Pull', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $actualValue = $actualRequestObject->getMaxMessages(); + $this->assertProtobufEquals($maxMessages, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function pullExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $maxMessages = 496131527; + $request = (new PullRequest()) + ->setSubscription($formattedSubscription) + ->setMaxMessages($maxMessages); + try { + $gapicClient->pull($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function seekTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new SeekResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $request = (new SeekRequest()) + ->setSubscription($formattedSubscription); + $response = $gapicClient->seek($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/Seek', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function seekExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $request = (new SeekRequest()) + ->setSubscription($formattedSubscription); + try { + $gapicClient->seek($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingPullTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new StreamingPullResponse(); + $transport->addResponse($expectedResponse); + $expectedResponse2 = new StreamingPullResponse(); + $transport->addResponse($expectedResponse2); + $expectedResponse3 = new StreamingPullResponse(); + $transport->addResponse($expectedResponse3); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $streamAckDeadlineSeconds = 1875467245; + $request = new StreamingPullRequest(); + $request->setSubscription($formattedSubscription); + $request->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds); + $formattedSubscription2 = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $streamAckDeadlineSeconds2 = 1562238880; + $request2 = new StreamingPullRequest(); + $request2->setSubscription($formattedSubscription2); + $request2->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds2); + $formattedSubscription3 = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $streamAckDeadlineSeconds3 = 1562238879; + $request3 = new StreamingPullRequest(); + $request3->setSubscription($formattedSubscription3); + $request3->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds3); + $bidi = $gapicClient->streamingPull(); + $this->assertInstanceOf(BidiStream::class, $bidi); + $bidi->write($request); + $responses = []; + $responses[] = $bidi->read(); + $bidi->writeAll([ + $request2, + $request3, + ]); + foreach ($bidi->closeWriteAndReadAll() as $response) { + $responses[] = $response; + } + + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $createStreamRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($createStreamRequests)); + $streamFuncCall = $createStreamRequests[0]->getFuncCall(); + $streamRequestObject = $createStreamRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/StreamingPull', $streamFuncCall); + $this->assertNull($streamRequestObject); + $callObjects = $transport->popCallObjects(); + $this->assertSame(1, count($callObjects)); + $bidiCall = $callObjects[0]; + $writeRequests = $bidiCall->popReceivedCalls(); + $expectedRequests = []; + $expectedRequests[] = $request; + $expectedRequests[] = $request2; + $expectedRequests[] = $request3; + $this->assertEquals($expectedRequests, $writeRequests); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingPullExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + $bidi = $gapicClient->streamingPull(); + $results = $bidi->closeWriteAndReadAll(); + try { + iterator_to_array($results); + // If the close stream method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSnapshotTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $topic = 'topic110546223'; + $expectedResponse = new Snapshot(); + $expectedResponse->setName($name); + $expectedResponse->setTopic($topic); + $transport->addResponse($expectedResponse); + // Mock request + $snapshot = new Snapshot(); + $updateMask = new FieldMask(); + $request = (new UpdateSnapshotRequest()) + ->setSnapshot($snapshot) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateSnapshot($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/UpdateSnapshot', $actualFuncCall); + $actualValue = $actualRequestObject->getSnapshot(); + $this->assertProtobufEquals($snapshot, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSnapshotExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $snapshot = new Snapshot(); + $updateMask = new FieldMask(); + $request = (new UpdateSnapshotRequest()) + ->setSnapshot($snapshot) + ->setUpdateMask($updateMask); + try { + $gapicClient->updateSnapshot($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSubscriptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $topic = 'topic110546223'; + $ackDeadlineSeconds = 2135351438; + $retainAckedMessages = false; + $enableMessageOrdering = true; + $filter = 'filter-1274492040'; + $detached = true; + $enableExactlyOnceDelivery = false; + $expectedResponse = new Subscription(); + $expectedResponse->setName($name); + $expectedResponse->setTopic($topic); + $expectedResponse->setAckDeadlineSeconds($ackDeadlineSeconds); + $expectedResponse->setRetainAckedMessages($retainAckedMessages); + $expectedResponse->setEnableMessageOrdering($enableMessageOrdering); + $expectedResponse->setFilter($filter); + $expectedResponse->setDetached($detached); + $expectedResponse->setEnableExactlyOnceDelivery($enableExactlyOnceDelivery); + $transport->addResponse($expectedResponse); + // Mock request + $subscription = new Subscription(); + $subscriptionName = 'subscriptionName-515935928'; + $subscription->setName($subscriptionName); + $subscriptionTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $subscription->setTopic($subscriptionTopic); + $updateMask = new FieldMask(); + $request = (new UpdateSubscriptionRequest()) + ->setSubscription($subscription) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateSubscription($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/UpdateSubscription', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($subscription, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSubscriptionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $subscription = new Subscription(); + $subscriptionName = 'subscriptionName-515935928'; + $subscription->setName($subscriptionName); + $subscriptionTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $subscription->setTopic($subscriptionTopic); + $updateMask = new FieldMask(); + $request = (new UpdateSubscriptionRequest()) + ->setSubscription($subscription) + ->setUpdateMask($updateMask); + try { + $gapicClient->updateSubscription($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + $response = $gapicClient->getIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + try { + $gapicClient->getIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + $response = $gapicClient->setIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + try { + $gapicClient->setIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + $response = $gapicClient->testIamPermissions($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + try { + $gapicClient->testIamPermissions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function acknowledgeAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $ackIds = []; + $request = (new AcknowledgeRequest()) + ->setSubscription($formattedSubscription) + ->setAckIds($ackIds); + $gapicClient->acknowledgeAsync($request)->wait(); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/Acknowledge', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $actualValue = $actualRequestObject->getAckIds(); + $this->assertProtobufEquals($ackIds, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/PubSub/v1/tests/Unit/V1/PublisherClientTest.php b/owl-bot-staging/PubSub/v1/tests/Unit/V1/PublisherClientTest.php new file mode 100644 index 000000000000..6995647cd719 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/tests/Unit/V1/PublisherClientTest.php @@ -0,0 +1,841 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return PublisherClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new PublisherClient($options); + } + + /** @test */ + public function createTopicTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $kmsKeyName2 = 'kmsKeyName2-1057489140'; + $satisfiesPzs2 = true; + $expectedResponse = new Topic(); + $expectedResponse->setName($name2); + $expectedResponse->setKmsKeyName($kmsKeyName2); + $expectedResponse->setSatisfiesPzs($satisfiesPzs2); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $response = $gapicClient->createTopic($name); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/CreateTopic', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createTopicExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + try { + $gapicClient->createTopic($name); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteTopicTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $gapicClient->deleteTopic($formattedTopic); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/DeleteTopic', $actualFuncCall); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($formattedTopic, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteTopicExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + try { + $gapicClient->deleteTopic($formattedTopic); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function detachSubscriptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new DetachSubscriptionResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $response = $gapicClient->detachSubscription($formattedSubscription); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/DetachSubscription', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function detachSubscriptionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + try { + $gapicClient->detachSubscription($formattedSubscription); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getTopicTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; + $expectedResponse = new Topic(); + $expectedResponse->setName($name); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $response = $gapicClient->getTopic($formattedTopic); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/GetTopic', $actualFuncCall); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($formattedTopic, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getTopicExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + try { + $gapicClient->getTopic($formattedTopic); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTopicSnapshotsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $snapshotsElement = 'snapshotsElement1339034092'; + $snapshots = [ + $snapshotsElement, + ]; + $expectedResponse = new ListTopicSnapshotsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSnapshots($snapshots); + $transport->addResponse($expectedResponse); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $response = $gapicClient->listTopicSnapshots($formattedTopic); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSnapshots()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/ListTopicSnapshots', $actualFuncCall); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($formattedTopic, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTopicSnapshotsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + try { + $gapicClient->listTopicSnapshots($formattedTopic); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTopicSubscriptionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $subscriptionsElement = 'subscriptionsElement1698708147'; + $subscriptions = [ + $subscriptionsElement, + ]; + $expectedResponse = new ListTopicSubscriptionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSubscriptions($subscriptions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $response = $gapicClient->listTopicSubscriptions($formattedTopic); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSubscriptions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/ListTopicSubscriptions', $actualFuncCall); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($formattedTopic, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTopicSubscriptionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + try { + $gapicClient->listTopicSubscriptions($formattedTopic); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTopicsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $topicsElement = new Topic(); + $topics = [ + $topicsElement, + ]; + $expectedResponse = new ListTopicsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTopics($topics); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProject = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listTopics($formattedProject); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTopics()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/ListTopics', $actualFuncCall); + $actualValue = $actualRequestObject->getProject(); + $this->assertProtobufEquals($formattedProject, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTopicsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedProject = $gapicClient->projectName('[PROJECT]'); + try { + $gapicClient->listTopics($formattedProject); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function publishTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new PublishResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $messages = []; + $response = $gapicClient->publish($formattedTopic, $messages); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/Publish', $actualFuncCall); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($formattedTopic, $actualValue); + $actualValue = $actualRequestObject->getMessages(); + $this->assertProtobufEquals($messages, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function publishExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $messages = []; + try { + $gapicClient->publish($formattedTopic, $messages); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateTopicTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $kmsKeyName = 'kmsKeyName2094986649'; + $satisfiesPzs = false; + $expectedResponse = new Topic(); + $expectedResponse->setName($name); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setSatisfiesPzs($satisfiesPzs); + $transport->addResponse($expectedResponse); + // Mock request + $topic = new Topic(); + $topicName = 'topicName388205658'; + $topic->setName($topicName); + $updateMask = new FieldMask(); + $response = $gapicClient->updateTopic($topic, $updateMask); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Publisher/UpdateTopic', $actualFuncCall); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($topic, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateTopicExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $topic = new Topic(); + $topicName = 'topicName388205658'; + $topic->setName($topicName); + $updateMask = new FieldMask(); + try { + $gapicClient->updateTopic($topic, $updateMask); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/PubSub/v1/tests/Unit/V1/SchemaServiceClientTest.php b/owl-bot-staging/PubSub/v1/tests/Unit/V1/SchemaServiceClientTest.php new file mode 100644 index 000000000000..7247b4ae3319 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/tests/Unit/V1/SchemaServiceClientTest.php @@ -0,0 +1,919 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return SchemaServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new SchemaServiceClient($options); + } + + /** @test */ + public function commitSchemaTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $definition = 'definition-1014418093'; + $revisionId = 'revisionId513861631'; + $expectedResponse = new Schema(); + $expectedResponse->setName($name2); + $expectedResponse->setDefinition($definition); + $expectedResponse->setRevisionId($revisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $schema = new Schema(); + $schemaName = 'schemaName-448762932'; + $schema->setName($schemaName); + $response = $gapicClient->commitSchema($formattedName, $schema); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/CommitSchema', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getSchema(); + $this->assertProtobufEquals($schema, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function commitSchemaExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $schema = new Schema(); + $schemaName = 'schemaName-448762932'; + $schema->setName($schemaName); + try { + $gapicClient->commitSchema($formattedName, $schema); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSchemaTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $definition = 'definition-1014418093'; + $revisionId = 'revisionId513861631'; + $expectedResponse = new Schema(); + $expectedResponse->setName($name); + $expectedResponse->setDefinition($definition); + $expectedResponse->setRevisionId($revisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $schema = new Schema(); + $schemaName = 'schemaName-448762932'; + $schema->setName($schemaName); + $response = $gapicClient->createSchema($formattedParent, $schema); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/CreateSchema', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getSchema(); + $this->assertProtobufEquals($schema, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSchemaExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $schema = new Schema(); + $schemaName = 'schemaName-448762932'; + $schema->setName($schemaName); + try { + $gapicClient->createSchema($formattedParent, $schema); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSchemaTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $gapicClient->deleteSchema($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/DeleteSchema', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSchemaExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + try { + $gapicClient->deleteSchema($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSchemaRevisionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $definition = 'definition-1014418093'; + $revisionId2 = 'revisionId2-100208654'; + $expectedResponse = new Schema(); + $expectedResponse->setName($name2); + $expectedResponse->setDefinition($definition); + $expectedResponse->setRevisionId($revisionId2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $revisionId = 'revisionId513861631'; + $response = $gapicClient->deleteSchemaRevision($formattedName, $revisionId); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/DeleteSchemaRevision', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getRevisionId(); + $this->assertProtobufEquals($revisionId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSchemaRevisionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $revisionId = 'revisionId513861631'; + try { + $gapicClient->deleteSchemaRevision($formattedName, $revisionId); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSchemaTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $definition = 'definition-1014418093'; + $revisionId = 'revisionId513861631'; + $expectedResponse = new Schema(); + $expectedResponse->setName($name2); + $expectedResponse->setDefinition($definition); + $expectedResponse->setRevisionId($revisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $response = $gapicClient->getSchema($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/GetSchema', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSchemaExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + try { + $gapicClient->getSchema($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSchemaRevisionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $schemasElement = new Schema(); + $schemas = [ + $schemasElement, + ]; + $expectedResponse = new ListSchemaRevisionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSchemas($schemas); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $response = $gapicClient->listSchemaRevisions($formattedName); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSchemas()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/ListSchemaRevisions', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSchemaRevisionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + try { + $gapicClient->listSchemaRevisions($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSchemasTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $schemasElement = new Schema(); + $schemas = [ + $schemasElement, + ]; + $expectedResponse = new ListSchemasResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSchemas($schemas); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listSchemas($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSchemas()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/ListSchemas', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSchemasExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + try { + $gapicClient->listSchemas($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function rollbackSchemaTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $definition = 'definition-1014418093'; + $revisionId2 = 'revisionId2-100208654'; + $expectedResponse = new Schema(); + $expectedResponse->setName($name2); + $expectedResponse->setDefinition($definition); + $expectedResponse->setRevisionId($revisionId2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $revisionId = 'revisionId513861631'; + $response = $gapicClient->rollbackSchema($formattedName, $revisionId); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/RollbackSchema', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getRevisionId(); + $this->assertProtobufEquals($revisionId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function rollbackSchemaExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); + $revisionId = 'revisionId513861631'; + try { + $gapicClient->rollbackSchema($formattedName, $revisionId); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function validateMessageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ValidateMessageResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->validateMessage($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/ValidateMessage', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function validateMessageExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + try { + $gapicClient->validateMessage($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function validateSchemaTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ValidateSchemaResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $schema = new Schema(); + $schemaName = 'schemaName-448762932'; + $schema->setName($schemaName); + $response = $gapicClient->validateSchema($formattedParent, $schema); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.SchemaService/ValidateSchema', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getSchema(); + $this->assertProtobufEquals($schema, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function validateSchemaExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $schema = new Schema(); + $schemaName = 'schemaName-448762932'; + $schema->setName($schemaName); + try { + $gapicClient->validateSchema($formattedParent, $schema); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/PubSub/v1/tests/Unit/V1/SubscriberClientTest.php b/owl-bot-staging/PubSub/v1/tests/Unit/V1/SubscriberClientTest.php new file mode 100644 index 000000000000..10119fbd8aa9 --- /dev/null +++ b/owl-bot-staging/PubSub/v1/tests/Unit/V1/SubscriberClientTest.php @@ -0,0 +1,1353 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return SubscriberClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new SubscriberClient($options); + } + + /** @test */ + public function acknowledgeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $ackIds = []; + $gapicClient->acknowledge($formattedSubscription, $ackIds); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/Acknowledge', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $actualValue = $actualRequestObject->getAckIds(); + $this->assertProtobufEquals($ackIds, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function acknowledgeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $ackIds = []; + try { + $gapicClient->acknowledge($formattedSubscription, $ackIds); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSnapshotTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $topic = 'topic110546223'; + $expectedResponse = new Snapshot(); + $expectedResponse->setName($name2); + $expectedResponse->setTopic($topic); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $response = $gapicClient->createSnapshot($formattedName, $formattedSubscription); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/CreateSnapshot', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSnapshotExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + try { + $gapicClient->createSnapshot($formattedName, $formattedSubscription); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSubscriptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $topic2 = 'topic2-1139259102'; + $ackDeadlineSeconds2 = 921632575; + $retainAckedMessages2 = true; + $enableMessageOrdering2 = false; + $filter2 = 'filter2-721168085'; + $detached2 = false; + $enableExactlyOnceDelivery2 = true; + $expectedResponse = new Subscription(); + $expectedResponse->setName($name2); + $expectedResponse->setTopic($topic2); + $expectedResponse->setAckDeadlineSeconds($ackDeadlineSeconds2); + $expectedResponse->setRetainAckedMessages($retainAckedMessages2); + $expectedResponse->setEnableMessageOrdering($enableMessageOrdering2); + $expectedResponse->setFilter($filter2); + $expectedResponse->setDetached($detached2); + $expectedResponse->setEnableExactlyOnceDelivery($enableExactlyOnceDelivery2); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $response = $gapicClient->createSubscription($name, $formattedTopic); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/CreateSubscription', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getTopic(); + $this->assertProtobufEquals($formattedTopic, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSubscriptionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + try { + $gapicClient->createSubscription($name, $formattedTopic); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSnapshotTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + $gapicClient->deleteSnapshot($formattedSnapshot); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/DeleteSnapshot', $actualFuncCall); + $actualValue = $actualRequestObject->getSnapshot(); + $this->assertProtobufEquals($formattedSnapshot, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSnapshotExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + try { + $gapicClient->deleteSnapshot($formattedSnapshot); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSubscriptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $gapicClient->deleteSubscription($formattedSubscription); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/DeleteSubscription', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSubscriptionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + try { + $gapicClient->deleteSubscription($formattedSubscription); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSnapshotTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $topic = 'topic110546223'; + $expectedResponse = new Snapshot(); + $expectedResponse->setName($name); + $expectedResponse->setTopic($topic); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + $response = $gapicClient->getSnapshot($formattedSnapshot); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/GetSnapshot', $actualFuncCall); + $actualValue = $actualRequestObject->getSnapshot(); + $this->assertProtobufEquals($formattedSnapshot, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSnapshotExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + try { + $gapicClient->getSnapshot($formattedSnapshot); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSubscriptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $topic = 'topic110546223'; + $ackDeadlineSeconds = 2135351438; + $retainAckedMessages = false; + $enableMessageOrdering = true; + $filter = 'filter-1274492040'; + $detached = true; + $enableExactlyOnceDelivery = false; + $expectedResponse = new Subscription(); + $expectedResponse->setName($name); + $expectedResponse->setTopic($topic); + $expectedResponse->setAckDeadlineSeconds($ackDeadlineSeconds); + $expectedResponse->setRetainAckedMessages($retainAckedMessages); + $expectedResponse->setEnableMessageOrdering($enableMessageOrdering); + $expectedResponse->setFilter($filter); + $expectedResponse->setDetached($detached); + $expectedResponse->setEnableExactlyOnceDelivery($enableExactlyOnceDelivery); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $response = $gapicClient->getSubscription($formattedSubscription); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/GetSubscription', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSubscriptionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + try { + $gapicClient->getSubscription($formattedSubscription); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSnapshotsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $snapshotsElement = new Snapshot(); + $snapshots = [ + $snapshotsElement, + ]; + $expectedResponse = new ListSnapshotsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSnapshots($snapshots); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProject = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listSnapshots($formattedProject); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSnapshots()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/ListSnapshots', $actualFuncCall); + $actualValue = $actualRequestObject->getProject(); + $this->assertProtobufEquals($formattedProject, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSnapshotsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedProject = $gapicClient->projectName('[PROJECT]'); + try { + $gapicClient->listSnapshots($formattedProject); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSubscriptionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $subscriptionsElement = new Subscription(); + $subscriptions = [ + $subscriptionsElement, + ]; + $expectedResponse = new ListSubscriptionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSubscriptions($subscriptions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedProject = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listSubscriptions($formattedProject); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSubscriptions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/ListSubscriptions', $actualFuncCall); + $actualValue = $actualRequestObject->getProject(); + $this->assertProtobufEquals($formattedProject, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSubscriptionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedProject = $gapicClient->projectName('[PROJECT]'); + try { + $gapicClient->listSubscriptions($formattedProject); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function modifyAckDeadlineTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $ackIds = []; + $ackDeadlineSeconds = 2135351438; + $gapicClient->modifyAckDeadline($formattedSubscription, $ackIds, $ackDeadlineSeconds); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/ModifyAckDeadline', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $actualValue = $actualRequestObject->getAckIds(); + $this->assertProtobufEquals($ackIds, $actualValue); + $actualValue = $actualRequestObject->getAckDeadlineSeconds(); + $this->assertProtobufEquals($ackDeadlineSeconds, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function modifyAckDeadlineExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $ackIds = []; + $ackDeadlineSeconds = 2135351438; + try { + $gapicClient->modifyAckDeadline($formattedSubscription, $ackIds, $ackDeadlineSeconds); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function modifyPushConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $pushConfig = new PushConfig(); + $gapicClient->modifyPushConfig($formattedSubscription, $pushConfig); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/ModifyPushConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $actualValue = $actualRequestObject->getPushConfig(); + $this->assertProtobufEquals($pushConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function modifyPushConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $pushConfig = new PushConfig(); + try { + $gapicClient->modifyPushConfig($formattedSubscription, $pushConfig); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function pullTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new PullResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $maxMessages = 496131527; + $response = $gapicClient->pull($formattedSubscription, $maxMessages); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/Pull', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $actualValue = $actualRequestObject->getMaxMessages(); + $this->assertProtobufEquals($maxMessages, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function pullExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $maxMessages = 496131527; + try { + $gapicClient->pull($formattedSubscription, $maxMessages); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function seekTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new SeekResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $response = $gapicClient->seek($formattedSubscription); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/Seek', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($formattedSubscription, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function seekExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + try { + $gapicClient->seek($formattedSubscription); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingPullTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new StreamingPullResponse(); + $transport->addResponse($expectedResponse); + $expectedResponse2 = new StreamingPullResponse(); + $transport->addResponse($expectedResponse2); + $expectedResponse3 = new StreamingPullResponse(); + $transport->addResponse($expectedResponse3); + // Mock request + $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $streamAckDeadlineSeconds = 1875467245; + $request = new StreamingPullRequest(); + $request->setSubscription($formattedSubscription); + $request->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds); + $formattedSubscription2 = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $streamAckDeadlineSeconds2 = 1562238880; + $request2 = new StreamingPullRequest(); + $request2->setSubscription($formattedSubscription2); + $request2->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds2); + $formattedSubscription3 = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + $streamAckDeadlineSeconds3 = 1562238879; + $request3 = new StreamingPullRequest(); + $request3->setSubscription($formattedSubscription3); + $request3->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds3); + $bidi = $gapicClient->streamingPull(); + $this->assertInstanceOf(BidiStream::class, $bidi); + $bidi->write($request); + $responses = []; + $responses[] = $bidi->read(); + $bidi->writeAll([ + $request2, + $request3, + ]); + foreach ($bidi->closeWriteAndReadAll() as $response) { + $responses[] = $response; + } + + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $createStreamRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($createStreamRequests)); + $streamFuncCall = $createStreamRequests[0]->getFuncCall(); + $streamRequestObject = $createStreamRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/StreamingPull', $streamFuncCall); + $this->assertNull($streamRequestObject); + $callObjects = $transport->popCallObjects(); + $this->assertSame(1, count($callObjects)); + $bidiCall = $callObjects[0]; + $writeRequests = $bidiCall->popReceivedCalls(); + $expectedRequests = []; + $expectedRequests[] = $request; + $expectedRequests[] = $request2; + $expectedRequests[] = $request3; + $this->assertEquals($expectedRequests, $writeRequests); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingPullExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + $bidi = $gapicClient->streamingPull(); + $results = $bidi->closeWriteAndReadAll(); + try { + iterator_to_array($results); + // If the close stream method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSnapshotTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $topic = 'topic110546223'; + $expectedResponse = new Snapshot(); + $expectedResponse->setName($name); + $expectedResponse->setTopic($topic); + $transport->addResponse($expectedResponse); + // Mock request + $snapshot = new Snapshot(); + $updateMask = new FieldMask(); + $response = $gapicClient->updateSnapshot($snapshot, $updateMask); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/UpdateSnapshot', $actualFuncCall); + $actualValue = $actualRequestObject->getSnapshot(); + $this->assertProtobufEquals($snapshot, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSnapshotExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $snapshot = new Snapshot(); + $updateMask = new FieldMask(); + try { + $gapicClient->updateSnapshot($snapshot, $updateMask); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSubscriptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $topic = 'topic110546223'; + $ackDeadlineSeconds = 2135351438; + $retainAckedMessages = false; + $enableMessageOrdering = true; + $filter = 'filter-1274492040'; + $detached = true; + $enableExactlyOnceDelivery = false; + $expectedResponse = new Subscription(); + $expectedResponse->setName($name); + $expectedResponse->setTopic($topic); + $expectedResponse->setAckDeadlineSeconds($ackDeadlineSeconds); + $expectedResponse->setRetainAckedMessages($retainAckedMessages); + $expectedResponse->setEnableMessageOrdering($enableMessageOrdering); + $expectedResponse->setFilter($filter); + $expectedResponse->setDetached($detached); + $expectedResponse->setEnableExactlyOnceDelivery($enableExactlyOnceDelivery); + $transport->addResponse($expectedResponse); + // Mock request + $subscription = new Subscription(); + $subscriptionName = 'subscriptionName-515935928'; + $subscription->setName($subscriptionName); + $subscriptionTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $subscription->setTopic($subscriptionTopic); + $updateMask = new FieldMask(); + $response = $gapicClient->updateSubscription($subscription, $updateMask); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.pubsub.v1.Subscriber/UpdateSubscription', $actualFuncCall); + $actualValue = $actualRequestObject->getSubscription(); + $this->assertProtobufEquals($subscription, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSubscriptionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $subscription = new Subscription(); + $subscriptionName = 'subscriptionName-515935928'; + $subscription->setName($subscriptionName); + $subscriptionTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); + $subscription->setTopic($subscriptionTopic); + $updateMask = new FieldMask(); + try { + $gapicClient->updateSubscription($subscription, $updateMask); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} From dcaabacf12dec245120ba9556d2468924f97fca0 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 20 Jun 2024 22:17:45 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- PubSub/metadata/V1/Pubsub.php | Bin 15668 -> 15721 bytes .../src/V1/CloudStorageConfig/AvroConfig.php | 38 + PubSub/src/V1/CloudStorageConfig/State.php | 8 + .../GPBMetadata/Google/Pubsub/V1/Pubsub.php | Bin 15721 -> 0 bytes .../GPBMetadata/Google/Pubsub/V1/Schema.php | Bin 5034 -> 0 bytes .../Cloud/PubSub/V1/AcknowledgeRequest.php | 132 -- .../Google/Cloud/PubSub/V1/BigQueryConfig.php | 347 ---- .../Cloud/PubSub/V1/BigQueryConfig/State.php | 91 - .../Cloud/PubSub/V1/CloudStorageConfig.php | 468 ----- .../V1/CloudStorageConfig/AvroConfig.php | 129 -- .../PubSub/V1/CloudStorageConfig/State.php | 88 - .../V1/CloudStorageConfig/TextConfig.php | 38 - .../Cloud/PubSub/V1/CommitSchemaRequest.php | 132 -- .../Cloud/PubSub/V1/CreateSchemaRequest.php | 200 -- .../Cloud/PubSub/V1/CreateSnapshotRequest.php | 221 --- .../Cloud/PubSub/V1/DeadLetterPolicy.php | 164 -- .../Cloud/PubSub/V1/DeleteSchemaRequest.php | 86 - .../PubSub/V1/DeleteSchemaRevisionRequest.php | 143 -- .../Cloud/PubSub/V1/DeleteSnapshotRequest.php | 86 - .../PubSub/V1/DeleteSubscriptionRequest.php | 86 - .../Cloud/PubSub/V1/DeleteTopicRequest.php | 86 - .../PubSub/V1/DetachSubscriptionRequest.php | 71 - .../PubSub/V1/DetachSubscriptionResponse.php | 34 - .../src/Google/Cloud/PubSub/V1/Encoding.php | 62 - .../Cloud/PubSub/V1/ExpirationPolicy.php | 98 - .../Cloud/PubSub/V1/GetSchemaRequest.php | 124 -- .../Cloud/PubSub/V1/GetSnapshotRequest.php | 86 - .../PubSub/V1/GetSubscriptionRequest.php | 86 - .../Cloud/PubSub/V1/GetTopicRequest.php | 86 - .../PubSub/V1/IngestionDataSourceSettings.php | 75 - .../AwsKinesis.php | 234 --- .../AwsKinesis/State.php | 95 - .../PubSub/V1/ListSchemaRevisionsRequest.php | 195 -- .../PubSub/V1/ListSchemaRevisionsResponse.php | 105 -- .../Cloud/PubSub/V1/ListSchemasRequest.php | 204 -- .../Cloud/PubSub/V1/ListSchemasResponse.php | 105 -- .../Cloud/PubSub/V1/ListSnapshotsRequest.php | 162 -- .../Cloud/PubSub/V1/ListSnapshotsResponse.php | 109 -- .../PubSub/V1/ListSubscriptionsRequest.php | 162 -- .../PubSub/V1/ListSubscriptionsResponse.php | 109 -- .../PubSub/V1/ListTopicSnapshotsRequest.php | 162 -- .../PubSub/V1/ListTopicSnapshotsResponse.php | 109 -- .../V1/ListTopicSubscriptionsRequest.php | 162 -- .../V1/ListTopicSubscriptionsResponse.php | 113 -- .../Cloud/PubSub/V1/ListTopicsRequest.php | 162 -- .../Cloud/PubSub/V1/ListTopicsResponse.php | 105 -- .../Cloud/PubSub/V1/MessageStoragePolicy.php | 137 -- .../PubSub/V1/ModifyAckDeadlineRequest.php | 198 -- .../PubSub/V1/ModifyPushConfigRequest.php | 153 -- .../Google/Cloud/PubSub/V1/PublishRequest.php | 122 -- .../Cloud/PubSub/V1/PublishResponse.php | 75 - .../Google/Cloud/PubSub/V1/PubsubMessage.php | 280 --- .../Google/Cloud/PubSub/V1/PullRequest.php | 222 --- .../Google/Cloud/PubSub/V1/PullResponse.php | 83 - .../src/Google/Cloud/PubSub/V1/PushConfig.php | 294 --- .../Cloud/PubSub/V1/PushConfig/NoWrapper.php | 78 - .../Cloud/PubSub/V1/PushConfig/OidcToken.php | 146 -- .../PubSub/V1/PushConfig/PubsubWrapper.php | 38 - .../Cloud/PubSub/V1/ReceivedMessage.php | 189 -- .../Google/Cloud/PubSub/V1/RetryPolicy.php | 140 -- .../Cloud/PubSub/V1/RollbackSchemaRequest.php | 128 -- .../src/Google/Cloud/PubSub/V1/Schema.php | 225 --- .../Google/Cloud/PubSub/V1/Schema/Type.php | 64 - .../Google/Cloud/PubSub/V1/SchemaSettings.php | 197 -- .../src/Google/Cloud/PubSub/V1/SchemaView.php | 62 - .../Google/Cloud/PubSub/V1/SeekRequest.php | 178 -- .../Google/Cloud/PubSub/V1/SeekResponse.php | 33 - .../src/Google/Cloud/PubSub/V1/Snapshot.php | 227 --- .../Cloud/PubSub/V1/StreamingPullRequest.php | 491 ----- .../Cloud/PubSub/V1/StreamingPullResponse.php | 208 --- .../AcknowledgeConfirmation.php | 181 -- .../ModifyAckDeadlineConfirmation.php | 147 -- .../SubscriptionProperties.php | 108 -- .../Google/Cloud/PubSub/V1/Subscription.php | 1090 ----------- .../Cloud/PubSub/V1/Subscription/State.php | 66 - .../src/Google/Cloud/PubSub/V1/Topic.php | 473 ----- .../Google/Cloud/PubSub/V1/Topic/State.php | 66 - .../Cloud/PubSub/V1/UpdateSnapshotRequest.php | 141 -- .../PubSub/V1/UpdateSubscriptionRequest.php | 141 -- .../Cloud/PubSub/V1/UpdateTopicRequest.php | 156 -- .../PubSub/V1/ValidateMessageRequest.php | 217 --- .../PubSub/V1/ValidateMessageResponse.php | 34 - .../Cloud/PubSub/V1/ValidateSchemaRequest.php | 132 -- .../PubSub/V1/ValidateSchemaResponse.php | 34 - .../V1/PublisherClient/create_topic.php | 75 - .../V1/PublisherClient/delete_topic.php | 74 - .../PublisherClient/detach_subscription.php | 75 - .../V1/PublisherClient/get_iam_policy.php | 72 - .../samples/V1/PublisherClient/get_topic.php | 72 - .../PublisherClient/list_topic_snapshots.php | 80 - .../list_topic_subscriptions.php | 76 - .../V1/PublisherClient/list_topics.php | 77 - .../v1/samples/V1/PublisherClient/publish.php | 76 - .../V1/PublisherClient/set_iam_policy.php | 77 - .../PublisherClient/test_iam_permissions.php | 84 - .../V1/PublisherClient/update_topic.php | 81 - .../V1/SchemaServiceClient/commit_schema.php | 78 - .../V1/SchemaServiceClient/create_schema.php | 78 - .../V1/SchemaServiceClient/delete_schema.php | 70 - .../delete_schema_revision.php | 79 - .../V1/SchemaServiceClient/get_iam_policy.php | 72 - .../V1/SchemaServiceClient/get_schema.php | 72 - .../list_schema_revisions.php | 76 - .../V1/SchemaServiceClient/list_schemas.php | 77 - .../SchemaServiceClient/rollback_schema.php | 77 - .../V1/SchemaServiceClient/set_iam_policy.php | 77 - .../test_iam_permissions.php | 84 - .../SchemaServiceClient/validate_message.php | 72 - .../SchemaServiceClient/validate_schema.php | 79 - .../V1/SubscriberClient/acknowledge.php | 82 - .../V1/SubscriberClient/create_snapshot.php | 103 - .../SubscriberClient/create_subscription.php | 90 - .../V1/SubscriberClient/delete_snapshot.php | 78 - .../SubscriberClient/delete_subscription.php | 74 - .../V1/SubscriberClient/get_iam_policy.php | 72 - .../V1/SubscriberClient/get_snapshot.php | 76 - .../V1/SubscriberClient/get_subscription.php | 72 - .../V1/SubscriberClient/list_snapshots.php | 81 - .../SubscriberClient/list_subscriptions.php | 77 - .../SubscriberClient/modify_ack_deadline.php | 92 - .../SubscriberClient/modify_push_config.php | 78 - .../v1/samples/V1/SubscriberClient/pull.php | 77 - .../v1/samples/V1/SubscriberClient/seek.php | 77 - .../V1/SubscriberClient/set_iam_policy.php | 77 - .../V1/SubscriberClient/streaming_pull.php | 92 - .../SubscriberClient/test_iam_permissions.php | 84 - .../V1/SubscriberClient/update_snapshot.php | 67 - .../SubscriberClient/update_subscription.php | 90 - .../v1/src/V1/Client/PublisherClient.php | 656 ------- .../v1/src/V1/Client/SchemaServiceClient.php | 604 ------ .../v1/src/V1/Client/SubscriberClient.php | 905 --------- .../v1/src/V1/Gapic/PublisherGapicClient.php | 1117 ----------- .../src/V1/Gapic/SchemaServiceGapicClient.php | 1006 ---------- .../v1/src/V1/Gapic/SubscriberGapicClient.php | 1664 ----------------- .../PubSub/v1/src/V1/PublisherClient.php | 34 - .../PubSub/v1/src/V1/SchemaServiceClient.php | 34 - .../PubSub/v1/src/V1/SubscriberClient.php | 34 - .../PubSub/v1/src/V1/gapic_metadata.json | 256 --- .../V1/resources/publisher_client_config.json | 132 -- .../resources/publisher_descriptor_config.php | 208 --- .../publisher_rest_client_config.php | 217 --- .../schema_service_client_config.json | 99 - .../schema_service_descriptor_config.php | 207 -- .../schema_service_rest_client_config.php | 229 --- .../resources/subscriber_client_config.json | 172 -- .../subscriber_descriptor_config.php | 280 --- .../subscriber_rest_client_config.php | 290 --- .../Unit/V1/Client/PublisherClientTest.php | 941 ---------- .../V1/Client/SchemaServiceClientTest.php | 1037 ---------- .../Unit/V1/Client/SubscriberClientTest.php | 1494 --------------- .../v1/tests/Unit/V1/PublisherClientTest.php | 841 --------- .../tests/Unit/V1/SchemaServiceClientTest.php | 919 --------- .../v1/tests/Unit/V1/SubscriberClientTest.php | 1353 -------------- 153 files changed, 46 insertions(+), 30644 deletions(-) delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/GPBMetadata/Google/Pubsub/V1/Pubsub.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/GPBMetadata/Google/Pubsub/V1/Schema.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/AcknowledgeRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig/State.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/AvroConfig.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/State.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/TextConfig.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CommitSchemaRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSchemaRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSnapshotRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeadLetterPolicy.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRevisionRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSnapshotRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSubscriptionRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteTopicRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Encoding.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ExpirationPolicy.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSchemaRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSnapshotRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSubscriptionRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetTopicRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis/State.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/MessageStoragePolicy.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyAckDeadlineRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyPushConfigRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PubsubMessage.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/NoWrapper.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/OidcToken.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/PubsubWrapper.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ReceivedMessage.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RetryPolicy.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RollbackSchemaRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema/Type.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaSettings.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaView.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Snapshot.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/AcknowledgeConfirmation.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/ModifyAckDeadlineConfirmation.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/SubscriptionProperties.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription/State.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic/State.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSnapshotRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSubscriptionRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateTopicRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaRequest.php delete mode 100644 owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaResponse.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/create_topic.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/delete_topic.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/detach_subscription.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_iam_policy.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_topic.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_snapshots.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_subscriptions.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topics.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/publish.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/set_iam_policy.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/test_iam_permissions.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/update_topic.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/commit_schema.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/create_schema.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema_revision.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_iam_policy.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_schema.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schema_revisions.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schemas.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/rollback_schema.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/set_iam_policy.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/test_iam_permissions.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_message.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_schema.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/acknowledge.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_snapshot.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_subscription.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_snapshot.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_subscription.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_iam_policy.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_snapshot.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_subscription.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_snapshots.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_subscriptions.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_ack_deadline.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_push_config.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/pull.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/seek.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/set_iam_policy.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/streaming_pull.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/test_iam_permissions.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_snapshot.php delete mode 100644 owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_subscription.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/Client/PublisherClient.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/Client/SchemaServiceClient.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/Client/SubscriberClient.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/Gapic/PublisherGapicClient.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/Gapic/SchemaServiceGapicClient.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/Gapic/SubscriberGapicClient.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/PublisherClient.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/SchemaServiceClient.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/SubscriberClient.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/gapic_metadata.json delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/publisher_client_config.json delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/publisher_descriptor_config.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/publisher_rest_client_config.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_client_config.json delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_descriptor_config.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_rest_client_config.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_client_config.json delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_descriptor_config.php delete mode 100644 owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_rest_client_config.php delete mode 100644 owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/PublisherClientTest.php delete mode 100644 owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SchemaServiceClientTest.php delete mode 100644 owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SubscriberClientTest.php delete mode 100644 owl-bot-staging/PubSub/v1/tests/Unit/V1/PublisherClientTest.php delete mode 100644 owl-bot-staging/PubSub/v1/tests/Unit/V1/SchemaServiceClientTest.php delete mode 100644 owl-bot-staging/PubSub/v1/tests/Unit/V1/SubscriberClientTest.php diff --git a/PubSub/metadata/V1/Pubsub.php b/PubSub/metadata/V1/Pubsub.php index f3397d12f3af01f4049712e6e47697a9b187f963..493b7610f5b5d4d680f0156ba5f5e1a8d836fff7 100644 GIT binary patch delta 66 zcmV-I0KNaTdg*$w%>x0+v(5uA76Hz){u$^20Z5bQ8!3~L7$1{w8B~*F93&MI6ABMg YLr6tUL0?TtQ%ylsLr4$>vxgk5AaP?CAOHXW delta 43 zcmV+`0M!5KdbE15%>x0Hv(5uA76F;F{u$^20V$K`8z}-Jb(3EQE0bLuO0&Eitss~N B5fA_X diff --git a/PubSub/src/V1/CloudStorageConfig/AvroConfig.php b/PubSub/src/V1/CloudStorageConfig/AvroConfig.php index 9b410cfa6ed6..a4da0ac163ed 100644 --- a/PubSub/src/V1/CloudStorageConfig/AvroConfig.php +++ b/PubSub/src/V1/CloudStorageConfig/AvroConfig.php @@ -27,6 +27,13 @@ class AvroConfig extends \Google\Protobuf\Internal\Message * Generated from protobuf field bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; */ private $write_metadata = false; + /** + * Optional. When true, the output Cloud Storage file will be serialized + * using the topic schema, if it exists. + * + * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $use_topic_schema = false; /** * Constructor. @@ -41,6 +48,9 @@ class AvroConfig extends \Google\Protobuf\Internal\Message * put in their own fields while all other message properties other than * data (for example, an ordering_key, if present) are added as entries in * the attributes map. + * @type bool $use_topic_schema + * Optional. When true, the output Cloud Storage file will be serialized + * using the topic schema, if it exists. * } */ public function __construct($data = NULL) { @@ -84,6 +94,34 @@ public function setWriteMetadata($var) return $this; } + /** + * Optional. When true, the output Cloud Storage file will be serialized + * using the topic schema, if it exists. + * + * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getUseTopicSchema() + { + return $this->use_topic_schema; + } + + /** + * Optional. When true, the output Cloud Storage file will be serialized + * using the topic schema, if it exists. + * + * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setUseTopicSchema($var) + { + GPBUtil::checkBool($var); + $this->use_topic_schema = $var; + + return $this; + } + } diff --git a/PubSub/src/V1/CloudStorageConfig/State.php b/PubSub/src/V1/CloudStorageConfig/State.php index 94318fdc0e20..a25e92b39016 100644 --- a/PubSub/src/V1/CloudStorageConfig/State.php +++ b/PubSub/src/V1/CloudStorageConfig/State.php @@ -45,6 +45,13 @@ class State * Generated from protobuf enum IN_TRANSIT_LOCATION_RESTRICTION = 4; */ const IN_TRANSIT_LOCATION_RESTRICTION = 4; + /** + * Cannot write to the Cloud Storage bucket due to an incompatibility + * between the topic schema and subscription settings. + * + * Generated from protobuf enum SCHEMA_MISMATCH = 5; + */ + const SCHEMA_MISMATCH = 5; private static $valueToName = [ self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', @@ -52,6 +59,7 @@ class State self::PERMISSION_DENIED => 'PERMISSION_DENIED', self::NOT_FOUND => 'NOT_FOUND', self::IN_TRANSIT_LOCATION_RESTRICTION => 'IN_TRANSIT_LOCATION_RESTRICTION', + self::SCHEMA_MISMATCH => 'SCHEMA_MISMATCH', ]; public static function name($value) diff --git a/owl-bot-staging/PubSub/v1/proto/src/GPBMetadata/Google/Pubsub/V1/Pubsub.php b/owl-bot-staging/PubSub/v1/proto/src/GPBMetadata/Google/Pubsub/V1/Pubsub.php deleted file mode 100644 index 493b7610f5b5d4d680f0156ba5f5e1a8d836fff7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15721 zcmc&*OKclSdUjKmEd7)vxkj>S`bD?BV_BBP5y#o_aMt!x5^V`%Jw}wB#Y9P`MYg1l zNOo^`Q?h2($Yznl<_QFw2arR8AV3f-kXsIm%_)}z*+UX+ZaVEDCtq?6_LRR~%_6%= zN*ZN%F4nNB{`%{G|6f&qJ!fIw^bt6+;SlYOaOMR!|m92bc$8mP5R@QB7`HijY{;c?GhEW2jn>EXK z&9aqwu{O7C1!lzz%*_{U(dHUkwE24W6M%Bn^!*I~1-^s~{)aTHb~)n*W`O_PwSB{` z+ktIX?JtnyCz)-t>RY%pI(NHKF9)_$&(H;{^|Cd2Kf`I#xp!R$PxvGgvOy1x2i{z& z2bNbitD6g!U-oP_aJ)5~n$Pc8K`1Kv%jA8rEhT4fXC^t1`Fw=QCz-%&SnBSXjAsQ6 zul@<+n-X{%{8pBQw%ZJM}Nvzgigiywf1p~YE2A=fkYTYmhWCe z-G~{IwUB%u6(A-=rQkCu^I_eD@ny^R%^jdb+M)iI(lULMLvwvUD`?~v5UalJVBEt+-JcZ_KQG*b>p~e^Ca4F027_&uuO_oFh)g&YB*Ey9bkX zMKOajcM~pc+nygFpfab4c9r|e`wHW!4+|$#N zpD9r)bdx@E1;7tH%d8ouS7*Xx+DwqEFkD6jH)@v0hC*4fA$nNPsak9(lv9Fa;Jux) zYxtJ8Z=)TU<+9VL2dRE3$%Ovr8uYXM$pl;~Z4@?&#;cXmT5*2q`BHIV>>L3YD9mpx zy)KSv*bZMnnS}GZ9#r5T-QfX;*#aJk=(5VSJy!LADH6ybZr#~yrcnGJDmCri_pJsRvQ*~jC|s;rZ1kr ze6K@lY2`(+v_Y+Qy;xd(wLV`oitFpE>tl)h#=F92a4kO2ar3*4!Th(Za^Ppb6o0+V z2GlU|2lnqsFxe68m%pmaWtwvx;L(WEJ z*FtBe5Ux;+8r@YIgbb+U0~p3rRc(LQph+l2<3myj(b6o!5`hLA$E#Q#Dw&#eGhS%v zSr~2GxTlJWF#5s@m%TcO@z{ zHl4~jf$1&TU?dEhshJhU3F0{|C1{<+R_Wh?5tKZY-&bItd>sabW~7F1MR{$}FyH+F zjE1}WE~WsBq#)T;vYPYt-`C*MORNdlnSIIb0$dRGD&+kkllMb-P_8FwymMXCYg;=3ALZSqhzU4PdJez9U$hjbhVLIP+$zGO?B9(}Txh8KY> zuz=d)^rz6O{_Ajc0XzEgt}0aNA>V{yRXxH@P&-)t9!op=bx6mN=ZDw-XAp+fed8*b z@KD^qj}sFys3hG6#&s+Wx9uGf*{{dN6@Pc0&EY6KakIRKNz<%UvDn4}0x4B|mT^RU(P08> z8xwmNoQZ8u7)8&x4tf?=l0&SLoQj@8RbjNCybD*Xy19i_xQxy+iKb{d6qan4tT(RB z@dH_LCYjvy=#Is3D)0Ze`rdV6=u%T&+%z&D`lfuA;or=3Yk@$ zzCr6L=I@K=$P$e362Um|Oc#+K5$j`ultPA=lfTMWa8epUZt6}*hBm6bxLI*pNu-~{ zP{<)crM2M;27-k)SBHpA7#z$-1<~EI=-n7I=~3Am3Hs?t7z#Hd*I?wpvjZAVITFuQ z!{f>+`jELRFkv?E-T=GgGDB}E;a#UPHv|`iRP{gZgOS#RM+kNpG^(qHf$&trw@{(j z{22l0DRW&vd$A^RvHHw3RE}|kskf)El2cxC=#o}_oK+tHpura@g$j=?P zwX|YvtQS^FOB=?^)%k*K%s1AT5OP{w8SB^oy&v(RNb!IK2eukm4k+%LpcOKvMNBs} z%Wyqw+kV4=0-iM0Q6Ddia5MzbH1ah_g==Y(Njqf&(bJk4uy@m4sWGn zTJV>~Tv^CudlXg{jb z3mf8J5+u^#O?n$kqC?KdVFbq#QLiqV^}ZCAR5w05#s5HqE6aHOvwhgCJ_3Svg4Fp>fybU+(TFt81m?o-+%sU6?`coQ3GY~nY@igpFX@+60 zm(V|hVa`qn30?9;AZX5~uuw90JL(l}F@r^E{m;OLuQ79v z;ud|#mcT7yW<{i_(feF^;nx)hNl;jlUw+d>K}$MOl3?XRO%AgRX6!n>gl(FWlF>zP zrB35npWYJjtgrvo08F$=^305tY(omqFO7m1J+!<+xR${^$=tK3*~fA-qZk(}f&>{} zx&)9B+M(j6{U$?}Sj8syqqdsN6_2}L#K)q$R^W=S0K8a#I@qNJHkMVqNQ}82jz63l zqY---RM^?le~OW|!{PCIHS|{H6#!Pfb{#Lx>1sHlxbl|(9&PPjjkd(6>n(Q9rtdsnBIfS@e(6ba3dCTGB_Z`t1ZzN zQ700Y!4k9!r!^Zp{rd@+n8)jR%%lR#meKZ6%hmMz3^~rg%?`M}SWMb+XSx-;6*w;L zOcq1blFB5R`!H(Lu?$Dx%acN1c;PT1s=YQ*;Byd(^s|Ciy<+3n9C)WJ<@Z%8ynjx> zprjK;)V1aUi1G{g#nl5i)odn|pd!$^%97IZNcOl*gP;LM>3Qh{aPRqhD3< z`IqksOFa#1^IjZaDDPhoEEIpf)mMPfj-XA4kK1%OGS?FF%Iwczf?rmhoizUii`bH7?MWfF2MpdYp5UU2WZ^usY+gtAvTQ^t z@`@=?cVMP~j?^={EuN!~cmmVI2dVl9UVyQ4aOvlMl!PIKC#!g?Zh7R}kmON{UGtGn zxA^H!1NsL?1@<)Pd;j&{KS0RO9EwB z$iFiK^GAhC3=W)bG+!7nZtmyqGH%%DOjn+;k-8v+LSk;>#E|4Arb`HCa4GA^)d=TG zb|j3YX?^ovlc#tQxm-C^R0l99A8?SEP34&6tD};#M+N@ugE4WN-0HytK_myL^D?XO zNzB`>=BV5~Mvv+wA(+{tf_xLv!i=yMMI`cx5BaeMmqSWw$>Eb2%r1VWWb%V(mhQAb zF#M!Nc3JYUhwQRyHR_WeYRY2_8J>Ldpc@};0X!XZ^U-9wIax6LaSOu_$o-xSOA_Qe zkW?=H<2+LtmLk0z9!2J8_RLyuGrFmsM)waWs_0dIoT#F+Br`FhikmD%^$li%U)LWo z5vht(?66g#Sqx(Qx;5?oq%eWbipzuq_9WH^=n8k1prlvQQwQ`uou`x}kDOA`liX&*`^Ln8_cRazV=$C4WE#r?ujq2);l zV^6xR%1$>GlYc_diXvO#AvAv(Z%@~Vh zddZZ?@_&o0iQFhgVp(gQavauP(ugBSMp9-rH^q%lOo*n-Ha7nN*=)rQV%cn+BH8TZ zBQdr%bxd2sm(}NKzaAIz6g(m>A U~>&VM&6skl>i4Q54#M19l)eiI9wJY~l{V9`op=;~9@EFQCSjR7r-= z440ldeav*GxAxXvI+-5&5A@Pwj_r*Tho15mbb9Ki-IZ*EjUlC6@MyosZ-3uwcON~m zwk&iSd>1PHfL49Bqr#)Ht<-kfGLyW2qVu7xT$y#8oS*s}>ijQZY}J zit96T2x(Q-al{p>j9wuT{=jBc*F?uvUHCVyJ0;!FU0to}p8?`|aYL;-1XPd8ZqyCU z)lEb66mo_}CMHE@(~}*yOxWSP7{Ks04I3_I4VT!4S}iURN3(UyHSIiz%JL?01FF0) z6O-JnXHMS`Cm2RqJ_2%HbnQB6_AZJxaqG4*M{#=w_JUuA!Jrf<}3aX_iG)g(k|LCoz zg$<9_QkfIW1+F&<*qlASG{%=`B|&;7h{w+%!@;8KlfVR|-$JOLRTI8~dc87?2%<1C zknA~7Liir)b$2Zi3Bjk!vp3_+RbxkSrW#)bA&e2KkPTXUrV;7!tl%*;Xp?Q-fs`!i zl}Il&-G89;9Vk6`9*qQxnoXd=lstHmevlfRjRxL$?BhWIJ#anJ9O|WhM^Je6c|KiQ zTVBbhQ`t;5y%0W!htW{JkXy~Aa!aM;S|*b&gav#7^(yOyTsS0W-YO|{gNKG~3!>u0 zp_3&zA9sMXPl)C^iC6sB9`9Q4#i1Q&Px?kc!zqfLX%)z)b;vUO5cONC4MoN290xl8 zQQpJHyPQV-%rIqqa5fTfKwBW>5NDi)=L#BN;vTn@aLGpDMdG$%nQaLyN77~UG1R-Q zlN}!U8=Y{hgN*cxfbf#;aIcO}LFy0%4=4rG=$=+J>lHtXYpS7c!sIvze}W}?VR;Rgabv8vS_%~9qTgh;70mNKv&n{ za0Dl;06epHCIx%Sa7ECy!(dn%N?(Q=OV5boKxO;vo(a$y-W6F;Z$ooFz9l|A2hGTD z&t9`VrbB@25IPUX4G%SKI~Va3xA%=et(B;-)gNt{Ma?&c&9am;w2~%8l z`S$rVz{fxc1_qt-(aFwW14)inrsy6@2^z~2pyLJrWYl`2Ty1;3 z`a@aUa$U=j6N#Oj9S$bAd#QDI3+~2nL729xs=Hy@wW)66%uUiucc{%H+e;3zfWno+ zHS@y9v(&sV1{#S?(|?!(9573mL90CH|M*)FUWcwN(&wmn%0m~=*UKyQa(sQ}jlWPV z(v_n3UIj}Vvj&gZ$=&8i>M@f*V#jR G2>lC@lYv_R diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/AcknowledgeRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/AcknowledgeRequest.php deleted file mode 100644 index bcea3e128240..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/AcknowledgeRequest.php +++ /dev/null @@ -1,132 +0,0 @@ -google.pubsub.v1.AcknowledgeRequest - */ -class AcknowledgeRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The subscription whose message is being acknowledged. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $subscription = ''; - /** - * Required. The acknowledgment ID for the messages being acknowledged that - * was returned by the Pub/Sub system in the `Pull` response. Must not be - * empty. - * - * Generated from protobuf field repeated string ack_ids = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - private $ack_ids; - - /** - * @param string $subscription Required. The subscription whose message is being acknowledged. - * Format is `projects/{project}/subscriptions/{sub}`. Please see - * {@see SubscriberClient::subscriptionName()} for help formatting this field. - * @param string[] $ackIds Required. The acknowledgment ID for the messages being acknowledged that - * was returned by the Pub/Sub system in the `Pull` response. Must not be - * empty. - * - * @return \Google\Cloud\PubSub\V1\AcknowledgeRequest - * - * @experimental - */ - public static function build(string $subscription, array $ackIds): self - { - return (new self()) - ->setSubscription($subscription) - ->setAckIds($ackIds); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $subscription - * Required. The subscription whose message is being acknowledged. - * Format is `projects/{project}/subscriptions/{sub}`. - * @type array|\Google\Protobuf\Internal\RepeatedField $ack_ids - * Required. The acknowledgment ID for the messages being acknowledged that - * was returned by the Pub/Sub system in the `Pull` response. Must not be - * empty. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The subscription whose message is being acknowledged. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Required. The subscription whose message is being acknowledged. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSubscription($var) - { - GPBUtil::checkString($var, True); - $this->subscription = $var; - - return $this; - } - - /** - * Required. The acknowledgment ID for the messages being acknowledged that - * was returned by the Pub/Sub system in the `Pull` response. Must not be - * empty. - * - * Generated from protobuf field repeated string ack_ids = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getAckIds() - { - return $this->ack_ids; - } - - /** - * Required. The acknowledgment ID for the messages being acknowledged that - * was returned by the Pub/Sub system in the `Pull` response. Must not be - * empty. - * - * Generated from protobuf field repeated string ack_ids = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setAckIds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->ack_ids = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig.php deleted file mode 100644 index 1f206785c596..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig.php +++ /dev/null @@ -1,347 +0,0 @@ -google.pubsub.v1.BigQueryConfig - */ -class BigQueryConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. The name of the table to which to write data, of the form - * {projectId}.{datasetId}.{tableId} - * - * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $table = ''; - /** - * Optional. When true, use the topic's schema as the columns to write to in - * BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be - * enabled at the same time. - * - * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $use_topic_schema = false; - /** - * Optional. When true, write the subscription name, message_id, publish_time, - * attributes, and ordering_key to additional columns in the table. The - * subscription name, message_id, and publish_time fields are put in their own - * columns while all other message properties (other than data) are written to - * a JSON object in the attributes column. - * - * Generated from protobuf field bool write_metadata = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $write_metadata = false; - /** - * Optional. When true and use_topic_schema is true, any fields that are a - * part of the topic schema that are not part of the BigQuery table schema are - * dropped when writing to BigQuery. Otherwise, the schemas must be kept in - * sync and any messages with extra fields are not written and remain in the - * subscription's backlog. - * - * Generated from protobuf field bool drop_unknown_fields = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $drop_unknown_fields = false; - /** - * Output only. An output-only field that indicates whether or not the - * subscription can receive messages. - * - * Generated from protobuf field .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 0; - /** - * Optional. When true, use the BigQuery table's schema as the columns to - * write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be - * enabled at the same time. - * - * Generated from protobuf field bool use_table_schema = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $use_table_schema = false; - /** - * Optional. The service account to use to write to BigQuery. The subscription - * creator or updater that specifies this field must have - * `iam.serviceAccounts.actAs` permission on the service account. If not - * specified, the Pub/Sub [service - * agent](https://cloud.google.com/iam/docs/service-agents), - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. - * - * Generated from protobuf field string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $service_account_email = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $table - * Optional. The name of the table to which to write data, of the form - * {projectId}.{datasetId}.{tableId} - * @type bool $use_topic_schema - * Optional. When true, use the topic's schema as the columns to write to in - * BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be - * enabled at the same time. - * @type bool $write_metadata - * Optional. When true, write the subscription name, message_id, publish_time, - * attributes, and ordering_key to additional columns in the table. The - * subscription name, message_id, and publish_time fields are put in their own - * columns while all other message properties (other than data) are written to - * a JSON object in the attributes column. - * @type bool $drop_unknown_fields - * Optional. When true and use_topic_schema is true, any fields that are a - * part of the topic schema that are not part of the BigQuery table schema are - * dropped when writing to BigQuery. Otherwise, the schemas must be kept in - * sync and any messages with extra fields are not written and remain in the - * subscription's backlog. - * @type int $state - * Output only. An output-only field that indicates whether or not the - * subscription can receive messages. - * @type bool $use_table_schema - * Optional. When true, use the BigQuery table's schema as the columns to - * write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be - * enabled at the same time. - * @type string $service_account_email - * Optional. The service account to use to write to BigQuery. The subscription - * creator or updater that specifies this field must have - * `iam.serviceAccounts.actAs` permission on the service account. If not - * specified, the Pub/Sub [service - * agent](https://cloud.google.com/iam/docs/service-agents), - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. The name of the table to which to write data, of the form - * {projectId}.{datasetId}.{tableId} - * - * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getTable() - { - return $this->table; - } - - /** - * Optional. The name of the table to which to write data, of the form - * {projectId}.{datasetId}.{tableId} - * - * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setTable($var) - { - GPBUtil::checkString($var, True); - $this->table = $var; - - return $this; - } - - /** - * Optional. When true, use the topic's schema as the columns to write to in - * BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be - * enabled at the same time. - * - * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getUseTopicSchema() - { - return $this->use_topic_schema; - } - - /** - * Optional. When true, use the topic's schema as the columns to write to in - * BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be - * enabled at the same time. - * - * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setUseTopicSchema($var) - { - GPBUtil::checkBool($var); - $this->use_topic_schema = $var; - - return $this; - } - - /** - * Optional. When true, write the subscription name, message_id, publish_time, - * attributes, and ordering_key to additional columns in the table. The - * subscription name, message_id, and publish_time fields are put in their own - * columns while all other message properties (other than data) are written to - * a JSON object in the attributes column. - * - * Generated from protobuf field bool write_metadata = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getWriteMetadata() - { - return $this->write_metadata; - } - - /** - * Optional. When true, write the subscription name, message_id, publish_time, - * attributes, and ordering_key to additional columns in the table. The - * subscription name, message_id, and publish_time fields are put in their own - * columns while all other message properties (other than data) are written to - * a JSON object in the attributes column. - * - * Generated from protobuf field bool write_metadata = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setWriteMetadata($var) - { - GPBUtil::checkBool($var); - $this->write_metadata = $var; - - return $this; - } - - /** - * Optional. When true and use_topic_schema is true, any fields that are a - * part of the topic schema that are not part of the BigQuery table schema are - * dropped when writing to BigQuery. Otherwise, the schemas must be kept in - * sync and any messages with extra fields are not written and remain in the - * subscription's backlog. - * - * Generated from protobuf field bool drop_unknown_fields = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getDropUnknownFields() - { - return $this->drop_unknown_fields; - } - - /** - * Optional. When true and use_topic_schema is true, any fields that are a - * part of the topic schema that are not part of the BigQuery table schema are - * dropped when writing to BigQuery. Otherwise, the schemas must be kept in - * sync and any messages with extra fields are not written and remain in the - * subscription's backlog. - * - * Generated from protobuf field bool drop_unknown_fields = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setDropUnknownFields($var) - { - GPBUtil::checkBool($var); - $this->drop_unknown_fields = $var; - - return $this; - } - - /** - * Output only. An output-only field that indicates whether or not the - * subscription can receive messages. - * - * Generated from protobuf field .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. An output-only field that indicates whether or not the - * subscription can receive messages. - * - * Generated from protobuf field .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\BigQueryConfig\State::class); - $this->state = $var; - - return $this; - } - - /** - * Optional. When true, use the BigQuery table's schema as the columns to - * write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be - * enabled at the same time. - * - * Generated from protobuf field bool use_table_schema = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getUseTableSchema() - { - return $this->use_table_schema; - } - - /** - * Optional. When true, use the BigQuery table's schema as the columns to - * write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be - * enabled at the same time. - * - * Generated from protobuf field bool use_table_schema = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setUseTableSchema($var) - { - GPBUtil::checkBool($var); - $this->use_table_schema = $var; - - return $this; - } - - /** - * Optional. The service account to use to write to BigQuery. The subscription - * creator or updater that specifies this field must have - * `iam.serviceAccounts.actAs` permission on the service account. If not - * specified, the Pub/Sub [service - * agent](https://cloud.google.com/iam/docs/service-agents), - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. - * - * Generated from protobuf field string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getServiceAccountEmail() - { - return $this->service_account_email; - } - - /** - * Optional. The service account to use to write to BigQuery. The subscription - * creator or updater that specifies this field must have - * `iam.serviceAccounts.actAs` permission on the service account. If not - * specified, the Pub/Sub [service - * agent](https://cloud.google.com/iam/docs/service-agents), - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. - * - * Generated from protobuf field string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setServiceAccountEmail($var) - { - GPBUtil::checkString($var, True); - $this->service_account_email = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig/State.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig/State.php deleted file mode 100644 index e92d03742eba..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/BigQueryConfig/State.php +++ /dev/null @@ -1,91 +0,0 @@ -google.pubsub.v1.BigQueryConfig.State - */ -class State -{ - /** - * Default value. This value is unused. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * The subscription can actively send messages to BigQuery - * - * Generated from protobuf enum ACTIVE = 1; - */ - const ACTIVE = 1; - /** - * Cannot write to the BigQuery table because of permission denied errors. - * This can happen if - * - Pub/Sub SA has not been granted the [appropriate BigQuery IAM - * permissions](https://cloud.google.com/pubsub/docs/create-subscription#assign_bigquery_service_account) - * - bigquery.googleapis.com API is not enabled for the project - * ([instructions](https://cloud.google.com/service-usage/docs/enable-disable)) - * - * Generated from protobuf enum PERMISSION_DENIED = 2; - */ - const PERMISSION_DENIED = 2; - /** - * Cannot write to the BigQuery table because it does not exist. - * - * Generated from protobuf enum NOT_FOUND = 3; - */ - const NOT_FOUND = 3; - /** - * Cannot write to the BigQuery table due to a schema mismatch. - * - * Generated from protobuf enum SCHEMA_MISMATCH = 4; - */ - const SCHEMA_MISMATCH = 4; - /** - * Cannot write to the destination because enforce_in_transit is set to true - * and the destination locations are not in the allowed regions. - * - * Generated from protobuf enum IN_TRANSIT_LOCATION_RESTRICTION = 5; - */ - const IN_TRANSIT_LOCATION_RESTRICTION = 5; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::ACTIVE => 'ACTIVE', - self::PERMISSION_DENIED => 'PERMISSION_DENIED', - self::NOT_FOUND => 'NOT_FOUND', - self::SCHEMA_MISMATCH => 'SCHEMA_MISMATCH', - self::IN_TRANSIT_LOCATION_RESTRICTION => 'IN_TRANSIT_LOCATION_RESTRICTION', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\PubSub\V1\BigQueryConfig_State::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig.php deleted file mode 100644 index 4c98327fa852..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig.php +++ /dev/null @@ -1,468 +0,0 @@ -google.pubsub.v1.CloudStorageConfig - */ -class CloudStorageConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Required. User-provided name for the Cloud Storage bucket. - * The bucket must be created by the user. The bucket name must be without - * any prefix like "gs://". See the [bucket naming - * requirements] (https://cloud.google.com/storage/docs/buckets#naming). - * - * Generated from protobuf field string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $bucket = ''; - /** - * Optional. User-provided prefix for Cloud Storage filename. See the [object - * naming requirements](https://cloud.google.com/storage/docs/objects#naming). - * - * Generated from protobuf field string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $filename_prefix = ''; - /** - * Optional. User-provided suffix for Cloud Storage filename. See the [object - * naming requirements](https://cloud.google.com/storage/docs/objects#naming). - * Must not end in "/". - * - * Generated from protobuf field string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $filename_suffix = ''; - /** - * Optional. User-provided format string specifying how to represent datetimes - * in Cloud Storage filenames. See the [datetime format - * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names). - * - * Generated from protobuf field string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $filename_datetime_format = ''; - /** - * Optional. The maximum duration that can elapse before a new Cloud Storage - * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not - * exceed the subscription's acknowledgement deadline. - * - * Generated from protobuf field .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $max_duration = null; - /** - * Optional. The maximum bytes that can be written to a Cloud Storage file - * before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may - * be exceeded in cases where messages are larger than the limit. - * - * Generated from protobuf field int64 max_bytes = 7 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $max_bytes = 0; - /** - * Output only. An output-only field that indicates whether or not the - * subscription can receive messages. - * - * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 0; - /** - * Optional. The service account to use to write to Cloud Storage. The - * subscription creator or updater that specifies this field must have - * `iam.serviceAccounts.actAs` permission on the service account. If not - * specified, the Pub/Sub - * [service agent](https://cloud.google.com/iam/docs/service-agents), - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. - * - * Generated from protobuf field string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $service_account_email = ''; - protected $output_format; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $bucket - * Required. User-provided name for the Cloud Storage bucket. - * The bucket must be created by the user. The bucket name must be without - * any prefix like "gs://". See the [bucket naming - * requirements] (https://cloud.google.com/storage/docs/buckets#naming). - * @type string $filename_prefix - * Optional. User-provided prefix for Cloud Storage filename. See the [object - * naming requirements](https://cloud.google.com/storage/docs/objects#naming). - * @type string $filename_suffix - * Optional. User-provided suffix for Cloud Storage filename. See the [object - * naming requirements](https://cloud.google.com/storage/docs/objects#naming). - * Must not end in "/". - * @type string $filename_datetime_format - * Optional. User-provided format string specifying how to represent datetimes - * in Cloud Storage filenames. See the [datetime format - * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names). - * @type \Google\Cloud\PubSub\V1\CloudStorageConfig\TextConfig $text_config - * Optional. If set, message data will be written to Cloud Storage in text - * format. - * @type \Google\Cloud\PubSub\V1\CloudStorageConfig\AvroConfig $avro_config - * Optional. If set, message data will be written to Cloud Storage in Avro - * format. - * @type \Google\Protobuf\Duration $max_duration - * Optional. The maximum duration that can elapse before a new Cloud Storage - * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not - * exceed the subscription's acknowledgement deadline. - * @type int|string $max_bytes - * Optional. The maximum bytes that can be written to a Cloud Storage file - * before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may - * be exceeded in cases where messages are larger than the limit. - * @type int $state - * Output only. An output-only field that indicates whether or not the - * subscription can receive messages. - * @type string $service_account_email - * Optional. The service account to use to write to Cloud Storage. The - * subscription creator or updater that specifies this field must have - * `iam.serviceAccounts.actAs` permission on the service account. If not - * specified, the Pub/Sub - * [service agent](https://cloud.google.com/iam/docs/service-agents), - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. User-provided name for the Cloud Storage bucket. - * The bucket must be created by the user. The bucket name must be without - * any prefix like "gs://". See the [bucket naming - * requirements] (https://cloud.google.com/storage/docs/buckets#naming). - * - * Generated from protobuf field string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getBucket() - { - return $this->bucket; - } - - /** - * Required. User-provided name for the Cloud Storage bucket. - * The bucket must be created by the user. The bucket name must be without - * any prefix like "gs://". See the [bucket naming - * requirements] (https://cloud.google.com/storage/docs/buckets#naming). - * - * Generated from protobuf field string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setBucket($var) - { - GPBUtil::checkString($var, True); - $this->bucket = $var; - - return $this; - } - - /** - * Optional. User-provided prefix for Cloud Storage filename. See the [object - * naming requirements](https://cloud.google.com/storage/docs/objects#naming). - * - * Generated from protobuf field string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getFilenamePrefix() - { - return $this->filename_prefix; - } - - /** - * Optional. User-provided prefix for Cloud Storage filename. See the [object - * naming requirements](https://cloud.google.com/storage/docs/objects#naming). - * - * Generated from protobuf field string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setFilenamePrefix($var) - { - GPBUtil::checkString($var, True); - $this->filename_prefix = $var; - - return $this; - } - - /** - * Optional. User-provided suffix for Cloud Storage filename. See the [object - * naming requirements](https://cloud.google.com/storage/docs/objects#naming). - * Must not end in "/". - * - * Generated from protobuf field string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getFilenameSuffix() - { - return $this->filename_suffix; - } - - /** - * Optional. User-provided suffix for Cloud Storage filename. See the [object - * naming requirements](https://cloud.google.com/storage/docs/objects#naming). - * Must not end in "/". - * - * Generated from protobuf field string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setFilenameSuffix($var) - { - GPBUtil::checkString($var, True); - $this->filename_suffix = $var; - - return $this; - } - - /** - * Optional. User-provided format string specifying how to represent datetimes - * in Cloud Storage filenames. See the [datetime format - * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names). - * - * Generated from protobuf field string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getFilenameDatetimeFormat() - { - return $this->filename_datetime_format; - } - - /** - * Optional. User-provided format string specifying how to represent datetimes - * in Cloud Storage filenames. See the [datetime format - * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names). - * - * Generated from protobuf field string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setFilenameDatetimeFormat($var) - { - GPBUtil::checkString($var, True); - $this->filename_datetime_format = $var; - - return $this; - } - - /** - * Optional. If set, message data will be written to Cloud Storage in text - * format. - * - * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\CloudStorageConfig\TextConfig|null - */ - public function getTextConfig() - { - return $this->readOneof(4); - } - - public function hasTextConfig() - { - return $this->hasOneof(4); - } - - /** - * Optional. If set, message data will be written to Cloud Storage in text - * format. - * - * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\CloudStorageConfig\TextConfig $var - * @return $this - */ - public function setTextConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\CloudStorageConfig\TextConfig::class); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * Optional. If set, message data will be written to Cloud Storage in Avro - * format. - * - * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\CloudStorageConfig\AvroConfig|null - */ - public function getAvroConfig() - { - return $this->readOneof(5); - } - - public function hasAvroConfig() - { - return $this->hasOneof(5); - } - - /** - * Optional. If set, message data will be written to Cloud Storage in Avro - * format. - * - * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\CloudStorageConfig\AvroConfig $var - * @return $this - */ - public function setAvroConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\CloudStorageConfig\AvroConfig::class); - $this->writeOneof(5, $var); - - return $this; - } - - /** - * Optional. The maximum duration that can elapse before a new Cloud Storage - * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not - * exceed the subscription's acknowledgement deadline. - * - * Generated from protobuf field .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Duration|null - */ - public function getMaxDuration() - { - return $this->max_duration; - } - - public function hasMaxDuration() - { - return isset($this->max_duration); - } - - public function clearMaxDuration() - { - unset($this->max_duration); - } - - /** - * Optional. The maximum duration that can elapse before a new Cloud Storage - * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not - * exceed the subscription's acknowledgement deadline. - * - * Generated from protobuf field .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setMaxDuration($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->max_duration = $var; - - return $this; - } - - /** - * Optional. The maximum bytes that can be written to a Cloud Storage file - * before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may - * be exceeded in cases where messages are larger than the limit. - * - * Generated from protobuf field int64 max_bytes = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @return int|string - */ - public function getMaxBytes() - { - return $this->max_bytes; - } - - /** - * Optional. The maximum bytes that can be written to a Cloud Storage file - * before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may - * be exceeded in cases where messages are larger than the limit. - * - * Generated from protobuf field int64 max_bytes = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @param int|string $var - * @return $this - */ - public function setMaxBytes($var) - { - GPBUtil::checkInt64($var); - $this->max_bytes = $var; - - return $this; - } - - /** - * Output only. An output-only field that indicates whether or not the - * subscription can receive messages. - * - * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. An output-only field that indicates whether or not the - * subscription can receive messages. - * - * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\CloudStorageConfig\State::class); - $this->state = $var; - - return $this; - } - - /** - * Optional. The service account to use to write to Cloud Storage. The - * subscription creator or updater that specifies this field must have - * `iam.serviceAccounts.actAs` permission on the service account. If not - * specified, the Pub/Sub - * [service agent](https://cloud.google.com/iam/docs/service-agents), - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. - * - * Generated from protobuf field string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getServiceAccountEmail() - { - return $this->service_account_email; - } - - /** - * Optional. The service account to use to write to Cloud Storage. The - * subscription creator or updater that specifies this field must have - * `iam.serviceAccounts.actAs` permission on the service account. If not - * specified, the Pub/Sub - * [service agent](https://cloud.google.com/iam/docs/service-agents), - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. - * - * Generated from protobuf field string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setServiceAccountEmail($var) - { - GPBUtil::checkString($var, True); - $this->service_account_email = $var; - - return $this; - } - - /** - * @return string - */ - public function getOutputFormat() - { - return $this->whichOneof("output_format"); - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/AvroConfig.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/AvroConfig.php deleted file mode 100644 index 03971b1d3dc5..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/AvroConfig.php +++ /dev/null @@ -1,129 +0,0 @@ -google.pubsub.v1.CloudStorageConfig.AvroConfig - */ -class AvroConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. When true, write the subscription name, message_id, - * publish_time, attributes, and ordering_key as additional fields in the - * output. The subscription name, message_id, and publish_time fields are - * put in their own fields while all other message properties other than - * data (for example, an ordering_key, if present) are added as entries in - * the attributes map. - * - * Generated from protobuf field bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $write_metadata = false; - /** - * Optional. When true, the output Cloud Storage file will be serialized - * using the topic schema, if it exists. - * - * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $use_topic_schema = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type bool $write_metadata - * Optional. When true, write the subscription name, message_id, - * publish_time, attributes, and ordering_key as additional fields in the - * output. The subscription name, message_id, and publish_time fields are - * put in their own fields while all other message properties other than - * data (for example, an ordering_key, if present) are added as entries in - * the attributes map. - * @type bool $use_topic_schema - * Optional. When true, the output Cloud Storage file will be serialized - * using the topic schema, if it exists. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. When true, write the subscription name, message_id, - * publish_time, attributes, and ordering_key as additional fields in the - * output. The subscription name, message_id, and publish_time fields are - * put in their own fields while all other message properties other than - * data (for example, an ordering_key, if present) are added as entries in - * the attributes map. - * - * Generated from protobuf field bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getWriteMetadata() - { - return $this->write_metadata; - } - - /** - * Optional. When true, write the subscription name, message_id, - * publish_time, attributes, and ordering_key as additional fields in the - * output. The subscription name, message_id, and publish_time fields are - * put in their own fields while all other message properties other than - * data (for example, an ordering_key, if present) are added as entries in - * the attributes map. - * - * Generated from protobuf field bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setWriteMetadata($var) - { - GPBUtil::checkBool($var); - $this->write_metadata = $var; - - return $this; - } - - /** - * Optional. When true, the output Cloud Storage file will be serialized - * using the topic schema, if it exists. - * - * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getUseTopicSchema() - { - return $this->use_topic_schema; - } - - /** - * Optional. When true, the output Cloud Storage file will be serialized - * using the topic schema, if it exists. - * - * Generated from protobuf field bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setUseTopicSchema($var) - { - GPBUtil::checkBool($var); - $this->use_topic_schema = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(AvroConfig::class, \Google\Cloud\PubSub\V1\CloudStorageConfig_AvroConfig::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/State.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/State.php deleted file mode 100644 index 394d25dbcc1e..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/State.php +++ /dev/null @@ -1,88 +0,0 @@ -google.pubsub.v1.CloudStorageConfig.State - */ -class State -{ - /** - * Default value. This value is unused. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * The subscription can actively send messages to Cloud Storage. - * - * Generated from protobuf enum ACTIVE = 1; - */ - const ACTIVE = 1; - /** - * Cannot write to the Cloud Storage bucket because of permission denied - * errors. - * - * Generated from protobuf enum PERMISSION_DENIED = 2; - */ - const PERMISSION_DENIED = 2; - /** - * Cannot write to the Cloud Storage bucket because it does not exist. - * - * Generated from protobuf enum NOT_FOUND = 3; - */ - const NOT_FOUND = 3; - /** - * Cannot write to the destination because enforce_in_transit is set to true - * and the destination locations are not in the allowed regions. - * - * Generated from protobuf enum IN_TRANSIT_LOCATION_RESTRICTION = 4; - */ - const IN_TRANSIT_LOCATION_RESTRICTION = 4; - /** - * Cannot write to the Cloud Storage bucket due to an incompatibility - * between the topic schema and subscription settings. - * - * Generated from protobuf enum SCHEMA_MISMATCH = 5; - */ - const SCHEMA_MISMATCH = 5; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::ACTIVE => 'ACTIVE', - self::PERMISSION_DENIED => 'PERMISSION_DENIED', - self::NOT_FOUND => 'NOT_FOUND', - self::IN_TRANSIT_LOCATION_RESTRICTION => 'IN_TRANSIT_LOCATION_RESTRICTION', - self::SCHEMA_MISMATCH => 'SCHEMA_MISMATCH', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\PubSub\V1\CloudStorageConfig_State::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/TextConfig.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/TextConfig.php deleted file mode 100644 index b76638c31137..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CloudStorageConfig/TextConfig.php +++ /dev/null @@ -1,38 +0,0 @@ -google.pubsub.v1.CloudStorageConfig.TextConfig - */ -class TextConfig extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(TextConfig::class, \Google\Cloud\PubSub\V1\CloudStorageConfig_TextConfig::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CommitSchemaRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CommitSchemaRequest.php deleted file mode 100644 index 29f01208b3c5..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CommitSchemaRequest.php +++ /dev/null @@ -1,132 +0,0 @@ -google.pubsub.v1.CommitSchemaRequest - */ -class CommitSchemaRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the schema we are revising. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * Required. The schema revision to commit. - * - * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $schema = null; - - /** - * @param string $name Required. The name of the schema we are revising. - * Format is `projects/{project}/schemas/{schema}`. Please see - * {@see SchemaServiceClient::schemaName()} for help formatting this field. - * @param \Google\Cloud\PubSub\V1\Schema $schema Required. The schema revision to commit. - * - * @return \Google\Cloud\PubSub\V1\CommitSchemaRequest - * - * @experimental - */ - public static function build(string $name, \Google\Cloud\PubSub\V1\Schema $schema): self - { - return (new self()) - ->setName($name) - ->setSchema($schema); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the schema we are revising. - * Format is `projects/{project}/schemas/{schema}`. - * @type \Google\Cloud\PubSub\V1\Schema $schema - * Required. The schema revision to commit. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the schema we are revising. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the schema we are revising. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Required. The schema revision to commit. - * - * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\PubSub\V1\Schema|null - */ - public function getSchema() - { - return $this->schema; - } - - public function hasSchema() - { - return isset($this->schema); - } - - public function clearSchema() - { - unset($this->schema); - } - - /** - * Required. The schema revision to commit. - * - * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\PubSub\V1\Schema $var - * @return $this - */ - public function setSchema($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Schema::class); - $this->schema = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSchemaRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSchemaRequest.php deleted file mode 100644 index 486fe277daa7..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSchemaRequest.php +++ /dev/null @@ -1,200 +0,0 @@ -google.pubsub.v1.CreateSchemaRequest - */ -class CreateSchemaRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the project in which to create the schema. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. The schema object to create. - * This schema's `name` parameter is ignored. The schema object returned - * by CreateSchema will have a `name` made using the given `parent` and - * `schema_id`. - * - * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $schema = null; - /** - * The ID to use for the schema, which will become the final component of - * the schema's resource name. - * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for - * resource name constraints. - * - * Generated from protobuf field string schema_id = 3; - */ - protected $schema_id = ''; - - /** - * @param string $parent Required. The name of the project in which to create the schema. - * Format is `projects/{project-id}`. Please see - * {@see SchemaServiceClient::projectName()} for help formatting this field. - * @param \Google\Cloud\PubSub\V1\Schema $schema Required. The schema object to create. - * - * This schema's `name` parameter is ignored. The schema object returned - * by CreateSchema will have a `name` made using the given `parent` and - * `schema_id`. - * @param string $schemaId The ID to use for the schema, which will become the final component of - * the schema's resource name. - * - * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for - * resource name constraints. - * - * @return \Google\Cloud\PubSub\V1\CreateSchemaRequest - * - * @experimental - */ - public static function build(string $parent, \Google\Cloud\PubSub\V1\Schema $schema, string $schemaId): self - { - return (new self()) - ->setParent($parent) - ->setSchema($schema) - ->setSchemaId($schemaId); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the project in which to create the schema. - * Format is `projects/{project-id}`. - * @type \Google\Cloud\PubSub\V1\Schema $schema - * Required. The schema object to create. - * This schema's `name` parameter is ignored. The schema object returned - * by CreateSchema will have a `name` made using the given `parent` and - * `schema_id`. - * @type string $schema_id - * The ID to use for the schema, which will become the final component of - * the schema's resource name. - * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for - * resource name constraints. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the project in which to create the schema. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the project in which to create the schema. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. The schema object to create. - * This schema's `name` parameter is ignored. The schema object returned - * by CreateSchema will have a `name` made using the given `parent` and - * `schema_id`. - * - * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\PubSub\V1\Schema|null - */ - public function getSchema() - { - return $this->schema; - } - - public function hasSchema() - { - return isset($this->schema); - } - - public function clearSchema() - { - unset($this->schema); - } - - /** - * Required. The schema object to create. - * This schema's `name` parameter is ignored. The schema object returned - * by CreateSchema will have a `name` made using the given `parent` and - * `schema_id`. - * - * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\PubSub\V1\Schema $var - * @return $this - */ - public function setSchema($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Schema::class); - $this->schema = $var; - - return $this; - } - - /** - * The ID to use for the schema, which will become the final component of - * the schema's resource name. - * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for - * resource name constraints. - * - * Generated from protobuf field string schema_id = 3; - * @return string - */ - public function getSchemaId() - { - return $this->schema_id; - } - - /** - * The ID to use for the schema, which will become the final component of - * the schema's resource name. - * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for - * resource name constraints. - * - * Generated from protobuf field string schema_id = 3; - * @param string $var - * @return $this - */ - public function setSchemaId($var) - { - GPBUtil::checkString($var, True); - $this->schema_id = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSnapshotRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSnapshotRequest.php deleted file mode 100644 index d886092613fc..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/CreateSnapshotRequest.php +++ /dev/null @@ -1,221 +0,0 @@ -google.pubsub.v1.CreateSnapshotRequest - */ -class CreateSnapshotRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. User-provided name for this snapshot. If the name is not provided - * in the request, the server will assign a random name for this snapshot on - * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the [resource name - * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). - * Format is `projects/{project}/snapshots/{snap}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * Required. The subscription whose backlog the snapshot retains. - * Specifically, the created snapshot is guaranteed to retain: - * (a) The existing backlog on the subscription. More precisely, this is - * defined as the messages in the subscription's backlog that are - * unacknowledged upon the successful completion of the - * `CreateSnapshot` request; as well as: - * (b) Any messages published to the subscription's topic following the - * successful completion of the CreateSnapshot request. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $subscription = ''; - /** - * Optional. See [Creating and managing - * labels](https://cloud.google.com/pubsub/docs/labels). - * - * Generated from protobuf field map labels = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $labels; - - /** - * @param string $name Required. User-provided name for this snapshot. If the name is not provided - * in the request, the server will assign a random name for this snapshot on - * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the [resource name - * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). - * Format is `projects/{project}/snapshots/{snap}`. Please see - * {@see SubscriberClient::snapshotName()} for help formatting this field. - * @param string $subscription Required. The subscription whose backlog the snapshot retains. - * Specifically, the created snapshot is guaranteed to retain: - * (a) The existing backlog on the subscription. More precisely, this is - * defined as the messages in the subscription's backlog that are - * unacknowledged upon the successful completion of the - * `CreateSnapshot` request; as well as: - * (b) Any messages published to the subscription's topic following the - * successful completion of the CreateSnapshot request. - * Format is `projects/{project}/subscriptions/{sub}`. Please see - * {@see SubscriberClient::subscriptionName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\CreateSnapshotRequest - * - * @experimental - */ - public static function build(string $name, string $subscription): self - { - return (new self()) - ->setName($name) - ->setSubscription($subscription); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. User-provided name for this snapshot. If the name is not provided - * in the request, the server will assign a random name for this snapshot on - * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the [resource name - * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). - * Format is `projects/{project}/snapshots/{snap}`. - * @type string $subscription - * Required. The subscription whose backlog the snapshot retains. - * Specifically, the created snapshot is guaranteed to retain: - * (a) The existing backlog on the subscription. More precisely, this is - * defined as the messages in the subscription's backlog that are - * unacknowledged upon the successful completion of the - * `CreateSnapshot` request; as well as: - * (b) Any messages published to the subscription's topic following the - * successful completion of the CreateSnapshot request. - * Format is `projects/{project}/subscriptions/{sub}`. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Optional. See [Creating and managing - * labels](https://cloud.google.com/pubsub/docs/labels). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. User-provided name for this snapshot. If the name is not provided - * in the request, the server will assign a random name for this snapshot on - * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the [resource name - * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). - * Format is `projects/{project}/snapshots/{snap}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. User-provided name for this snapshot. If the name is not provided - * in the request, the server will assign a random name for this snapshot on - * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the [resource name - * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). - * Format is `projects/{project}/snapshots/{snap}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Required. The subscription whose backlog the snapshot retains. - * Specifically, the created snapshot is guaranteed to retain: - * (a) The existing backlog on the subscription. More precisely, this is - * defined as the messages in the subscription's backlog that are - * unacknowledged upon the successful completion of the - * `CreateSnapshot` request; as well as: - * (b) Any messages published to the subscription's topic following the - * successful completion of the CreateSnapshot request. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Required. The subscription whose backlog the snapshot retains. - * Specifically, the created snapshot is guaranteed to retain: - * (a) The existing backlog on the subscription. More precisely, this is - * defined as the messages in the subscription's backlog that are - * unacknowledged upon the successful completion of the - * `CreateSnapshot` request; as well as: - * (b) Any messages published to the subscription's topic following the - * successful completion of the CreateSnapshot request. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSubscription($var) - { - GPBUtil::checkString($var, True); - $this->subscription = $var; - - return $this; - } - - /** - * Optional. See [Creating and managing - * labels](https://cloud.google.com/pubsub/docs/labels). - * - * Generated from protobuf field map labels = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Optional. See [Creating and managing - * labels](https://cloud.google.com/pubsub/docs/labels). - * - * Generated from protobuf field map labels = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setLabels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->labels = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeadLetterPolicy.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeadLetterPolicy.php deleted file mode 100644 index b7286c36759b..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeadLetterPolicy.php +++ /dev/null @@ -1,164 +0,0 @@ -google.pubsub.v1.DeadLetterPolicy - */ -class DeadLetterPolicy extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. The name of the topic to which dead letter messages should be - * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub - * service account associated with the enclosing subscription's parent project - * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must - * have permission to Publish() to this topic. - * The operation will fail if the topic does not exist. - * Users should ensure that there is a subscription attached to this topic - * since messages published to a topic with no subscriptions are lost. - * - * Generated from protobuf field string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $dead_letter_topic = ''; - /** - * Optional. The maximum number of delivery attempts for any message. The - * value must be between 5 and 100. - * The number of delivery attempts is defined as 1 + (the sum of number of - * NACKs and number of times the acknowledgement deadline has been exceeded - * for the message). - * A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that - * client libraries may automatically extend ack_deadlines. - * This field will be honored on a best effort basis. - * If this parameter is 0, a default value of 5 is used. - * - * Generated from protobuf field int32 max_delivery_attempts = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $max_delivery_attempts = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $dead_letter_topic - * Optional. The name of the topic to which dead letter messages should be - * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub - * service account associated with the enclosing subscription's parent project - * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must - * have permission to Publish() to this topic. - * The operation will fail if the topic does not exist. - * Users should ensure that there is a subscription attached to this topic - * since messages published to a topic with no subscriptions are lost. - * @type int $max_delivery_attempts - * Optional. The maximum number of delivery attempts for any message. The - * value must be between 5 and 100. - * The number of delivery attempts is defined as 1 + (the sum of number of - * NACKs and number of times the acknowledgement deadline has been exceeded - * for the message). - * A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that - * client libraries may automatically extend ack_deadlines. - * This field will be honored on a best effort basis. - * If this parameter is 0, a default value of 5 is used. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. The name of the topic to which dead letter messages should be - * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub - * service account associated with the enclosing subscription's parent project - * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must - * have permission to Publish() to this topic. - * The operation will fail if the topic does not exist. - * Users should ensure that there is a subscription attached to this topic - * since messages published to a topic with no subscriptions are lost. - * - * Generated from protobuf field string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getDeadLetterTopic() - { - return $this->dead_letter_topic; - } - - /** - * Optional. The name of the topic to which dead letter messages should be - * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub - * service account associated with the enclosing subscription's parent project - * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must - * have permission to Publish() to this topic. - * The operation will fail if the topic does not exist. - * Users should ensure that there is a subscription attached to this topic - * since messages published to a topic with no subscriptions are lost. - * - * Generated from protobuf field string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setDeadLetterTopic($var) - { - GPBUtil::checkString($var, True); - $this->dead_letter_topic = $var; - - return $this; - } - - /** - * Optional. The maximum number of delivery attempts for any message. The - * value must be between 5 and 100. - * The number of delivery attempts is defined as 1 + (the sum of number of - * NACKs and number of times the acknowledgement deadline has been exceeded - * for the message). - * A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that - * client libraries may automatically extend ack_deadlines. - * This field will be honored on a best effort basis. - * If this parameter is 0, a default value of 5 is used. - * - * Generated from protobuf field int32 max_delivery_attempts = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getMaxDeliveryAttempts() - { - return $this->max_delivery_attempts; - } - - /** - * Optional. The maximum number of delivery attempts for any message. The - * value must be between 5 and 100. - * The number of delivery attempts is defined as 1 + (the sum of number of - * NACKs and number of times the acknowledgement deadline has been exceeded - * for the message). - * A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that - * client libraries may automatically extend ack_deadlines. - * This field will be honored on a best effort basis. - * If this parameter is 0, a default value of 5 is used. - * - * Generated from protobuf field int32 max_delivery_attempts = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setMaxDeliveryAttempts($var) - { - GPBUtil::checkInt32($var); - $this->max_delivery_attempts = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRequest.php deleted file mode 100644 index ff8bdac822d5..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRequest.php +++ /dev/null @@ -1,86 +0,0 @@ -google.pubsub.v1.DeleteSchemaRequest - */ -class DeleteSchemaRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Name of the schema to delete. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. Name of the schema to delete. - * Format is `projects/{project}/schemas/{schema}`. Please see - * {@see SchemaServiceClient::schemaName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\DeleteSchemaRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Name of the schema to delete. - * Format is `projects/{project}/schemas/{schema}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - - /** - * Required. Name of the schema to delete. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Name of the schema to delete. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRevisionRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRevisionRequest.php deleted file mode 100644 index fdb3da46606f..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSchemaRevisionRequest.php +++ /dev/null @@ -1,143 +0,0 @@ -google.pubsub.v1.DeleteSchemaRevisionRequest - */ -class DeleteSchemaRevisionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the schema revision to be deleted, with a revision ID - * explicitly included. - * Example: `projects/123/schemas/my-schema@c7cfa2a8` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * Optional. This field is deprecated and should not be used for specifying - * the revision ID. The revision ID should be specified via the `name` - * parameter. - * - * Generated from protobuf field string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; - * @deprecated - */ - protected $revision_id = ''; - - /** - * @param string $name Required. The name of the schema revision to be deleted, with a revision ID - * explicitly included. - * - * Example: `projects/123/schemas/my-schema@c7cfa2a8` - * Please see {@see SchemaServiceClient::schemaName()} for help formatting this field. - * @param string $revisionId Optional. This field is deprecated and should not be used for specifying - * the revision ID. The revision ID should be specified via the `name` - * parameter. - * - * @return \Google\Cloud\PubSub\V1\DeleteSchemaRevisionRequest - * - * @experimental - */ - public static function build(string $name, string $revisionId): self - { - return (new self()) - ->setName($name) - ->setRevisionId($revisionId); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the schema revision to be deleted, with a revision ID - * explicitly included. - * Example: `projects/123/schemas/my-schema@c7cfa2a8` - * @type string $revision_id - * Optional. This field is deprecated and should not be used for specifying - * the revision ID. The revision ID should be specified via the `name` - * parameter. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the schema revision to be deleted, with a revision ID - * explicitly included. - * Example: `projects/123/schemas/my-schema@c7cfa2a8` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the schema revision to be deleted, with a revision ID - * explicitly included. - * Example: `projects/123/schemas/my-schema@c7cfa2a8` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Optional. This field is deprecated and should not be used for specifying - * the revision ID. The revision ID should be specified via the `name` - * parameter. - * - * Generated from protobuf field string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; - * @return string - * @deprecated - */ - public function getRevisionId() - { - @trigger_error('revision_id is deprecated.', E_USER_DEPRECATED); - return $this->revision_id; - } - - /** - * Optional. This field is deprecated and should not be used for specifying - * the revision ID. The revision ID should be specified via the `name` - * parameter. - * - * Generated from protobuf field string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - * @deprecated - */ - public function setRevisionId($var) - { - @trigger_error('revision_id is deprecated.', E_USER_DEPRECATED); - GPBUtil::checkString($var, True); - $this->revision_id = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSnapshotRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSnapshotRequest.php deleted file mode 100644 index 3b766a683419..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSnapshotRequest.php +++ /dev/null @@ -1,86 +0,0 @@ -google.pubsub.v1.DeleteSnapshotRequest - */ -class DeleteSnapshotRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the snapshot to delete. - * Format is `projects/{project}/snapshots/{snap}`. - * - * Generated from protobuf field string snapshot = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $snapshot = ''; - - /** - * @param string $snapshot Required. The name of the snapshot to delete. - * Format is `projects/{project}/snapshots/{snap}`. Please see - * {@see SubscriberClient::snapshotName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\DeleteSnapshotRequest - * - * @experimental - */ - public static function build(string $snapshot): self - { - return (new self()) - ->setSnapshot($snapshot); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $snapshot - * Required. The name of the snapshot to delete. - * Format is `projects/{project}/snapshots/{snap}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the snapshot to delete. - * Format is `projects/{project}/snapshots/{snap}`. - * - * Generated from protobuf field string snapshot = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSnapshot() - { - return $this->snapshot; - } - - /** - * Required. The name of the snapshot to delete. - * Format is `projects/{project}/snapshots/{snap}`. - * - * Generated from protobuf field string snapshot = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSnapshot($var) - { - GPBUtil::checkString($var, True); - $this->snapshot = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSubscriptionRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSubscriptionRequest.php deleted file mode 100644 index 9bef784bfab3..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteSubscriptionRequest.php +++ /dev/null @@ -1,86 +0,0 @@ -google.pubsub.v1.DeleteSubscriptionRequest - */ -class DeleteSubscriptionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The subscription to delete. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $subscription = ''; - - /** - * @param string $subscription Required. The subscription to delete. - * Format is `projects/{project}/subscriptions/{sub}`. Please see - * {@see SubscriberClient::subscriptionName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\DeleteSubscriptionRequest - * - * @experimental - */ - public static function build(string $subscription): self - { - return (new self()) - ->setSubscription($subscription); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $subscription - * Required. The subscription to delete. - * Format is `projects/{project}/subscriptions/{sub}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The subscription to delete. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Required. The subscription to delete. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSubscription($var) - { - GPBUtil::checkString($var, True); - $this->subscription = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteTopicRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteTopicRequest.php deleted file mode 100644 index bdd8fbafdf8f..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DeleteTopicRequest.php +++ /dev/null @@ -1,86 +0,0 @@ -google.pubsub.v1.DeleteTopicRequest - */ -class DeleteTopicRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Name of the topic to delete. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $topic = ''; - - /** - * @param string $topic Required. Name of the topic to delete. - * Format is `projects/{project}/topics/{topic}`. Please see - * {@see PublisherClient::topicName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\DeleteTopicRequest - * - * @experimental - */ - public static function build(string $topic): self - { - return (new self()) - ->setTopic($topic); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $topic - * Required. Name of the topic to delete. - * Format is `projects/{project}/topics/{topic}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. Name of the topic to delete. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getTopic() - { - return $this->topic; - } - - /** - * Required. Name of the topic to delete. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setTopic($var) - { - GPBUtil::checkString($var, True); - $this->topic = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionRequest.php deleted file mode 100644 index 4279c67be0e4..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionRequest.php +++ /dev/null @@ -1,71 +0,0 @@ -google.pubsub.v1.DetachSubscriptionRequest - */ -class DetachSubscriptionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The subscription to detach. - * Format is `projects/{project}/subscriptions/{subscription}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $subscription = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $subscription - * Required. The subscription to detach. - * Format is `projects/{project}/subscriptions/{subscription}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The subscription to detach. - * Format is `projects/{project}/subscriptions/{subscription}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Required. The subscription to detach. - * Format is `projects/{project}/subscriptions/{subscription}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSubscription($var) - { - GPBUtil::checkString($var, True); - $this->subscription = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionResponse.php deleted file mode 100644 index 99d903a39c5d..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/DetachSubscriptionResponse.php +++ /dev/null @@ -1,34 +0,0 @@ -google.pubsub.v1.DetachSubscriptionResponse - */ -class DetachSubscriptionResponse extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Encoding.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Encoding.php deleted file mode 100644 index 44b74224b4ab..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Encoding.php +++ /dev/null @@ -1,62 +0,0 @@ -google.pubsub.v1.Encoding - */ -class Encoding -{ - /** - * Unspecified - * - * Generated from protobuf enum ENCODING_UNSPECIFIED = 0; - */ - const ENCODING_UNSPECIFIED = 0; - /** - * JSON encoding - * - * Generated from protobuf enum JSON = 1; - */ - const JSON = 1; - /** - * Binary encoding, as defined by the schema type. For some schema types, - * binary encoding may not be available. - * - * Generated from protobuf enum BINARY = 2; - */ - const BINARY = 2; - - private static $valueToName = [ - self::ENCODING_UNSPECIFIED => 'ENCODING_UNSPECIFIED', - self::JSON => 'JSON', - self::BINARY => 'BINARY', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ExpirationPolicy.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ExpirationPolicy.php deleted file mode 100644 index dd88b82331f5..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ExpirationPolicy.php +++ /dev/null @@ -1,98 +0,0 @@ -google.pubsub.v1.ExpirationPolicy - */ -class ExpirationPolicy extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. Specifies the "time-to-live" duration for an associated resource. - * The resource expires if it is not active for a period of `ttl`. The - * definition of "activity" depends on the type of the associated resource. - * The minimum and maximum allowed values for `ttl` depend on the type of the - * associated resource, as well. If `ttl` is not set, the associated resource - * never expires. - * - * Generated from protobuf field .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $ttl = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Protobuf\Duration $ttl - * Optional. Specifies the "time-to-live" duration for an associated resource. - * The resource expires if it is not active for a period of `ttl`. The - * definition of "activity" depends on the type of the associated resource. - * The minimum and maximum allowed values for `ttl` depend on the type of the - * associated resource, as well. If `ttl` is not set, the associated resource - * never expires. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. Specifies the "time-to-live" duration for an associated resource. - * The resource expires if it is not active for a period of `ttl`. The - * definition of "activity" depends on the type of the associated resource. - * The minimum and maximum allowed values for `ttl` depend on the type of the - * associated resource, as well. If `ttl` is not set, the associated resource - * never expires. - * - * Generated from protobuf field .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Duration|null - */ - public function getTtl() - { - return $this->ttl; - } - - public function hasTtl() - { - return isset($this->ttl); - } - - public function clearTtl() - { - unset($this->ttl); - } - - /** - * Optional. Specifies the "time-to-live" duration for an associated resource. - * The resource expires if it is not active for a period of `ttl`. The - * definition of "activity" depends on the type of the associated resource. - * The minimum and maximum allowed values for `ttl` depend on the type of the - * associated resource, as well. If `ttl` is not set, the associated resource - * never expires. - * - * Generated from protobuf field .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setTtl($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->ttl = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSchemaRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSchemaRequest.php deleted file mode 100644 index afbe7ce6056b..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSchemaRequest.php +++ /dev/null @@ -1,124 +0,0 @@ -google.pubsub.v1.GetSchemaRequest - */ -class GetSchemaRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the schema to get. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * The set of fields to return in the response. If not set, returns a Schema - * with all fields filled out. Set to `BASIC` to omit the `definition`. - * - * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; - */ - protected $view = 0; - - /** - * @param string $name Required. The name of the schema to get. - * Format is `projects/{project}/schemas/{schema}`. Please see - * {@see SchemaServiceClient::schemaName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\GetSchemaRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the schema to get. - * Format is `projects/{project}/schemas/{schema}`. - * @type int $view - * The set of fields to return in the response. If not set, returns a Schema - * with all fields filled out. Set to `BASIC` to omit the `definition`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the schema to get. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the schema to get. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The set of fields to return in the response. If not set, returns a Schema - * with all fields filled out. Set to `BASIC` to omit the `definition`. - * - * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; - * @return int - */ - public function getView() - { - return $this->view; - } - - /** - * The set of fields to return in the response. If not set, returns a Schema - * with all fields filled out. Set to `BASIC` to omit the `definition`. - * - * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; - * @param int $var - * @return $this - */ - public function setView($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\SchemaView::class); - $this->view = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSnapshotRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSnapshotRequest.php deleted file mode 100644 index 55f4ab4e63aa..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSnapshotRequest.php +++ /dev/null @@ -1,86 +0,0 @@ -google.pubsub.v1.GetSnapshotRequest - */ -class GetSnapshotRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the snapshot to get. - * Format is `projects/{project}/snapshots/{snap}`. - * - * Generated from protobuf field string snapshot = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $snapshot = ''; - - /** - * @param string $snapshot Required. The name of the snapshot to get. - * Format is `projects/{project}/snapshots/{snap}`. Please see - * {@see SubscriberClient::snapshotName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\GetSnapshotRequest - * - * @experimental - */ - public static function build(string $snapshot): self - { - return (new self()) - ->setSnapshot($snapshot); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $snapshot - * Required. The name of the snapshot to get. - * Format is `projects/{project}/snapshots/{snap}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the snapshot to get. - * Format is `projects/{project}/snapshots/{snap}`. - * - * Generated from protobuf field string snapshot = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSnapshot() - { - return $this->snapshot; - } - - /** - * Required. The name of the snapshot to get. - * Format is `projects/{project}/snapshots/{snap}`. - * - * Generated from protobuf field string snapshot = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSnapshot($var) - { - GPBUtil::checkString($var, True); - $this->snapshot = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSubscriptionRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSubscriptionRequest.php deleted file mode 100644 index e9a42ecdf588..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetSubscriptionRequest.php +++ /dev/null @@ -1,86 +0,0 @@ -google.pubsub.v1.GetSubscriptionRequest - */ -class GetSubscriptionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the subscription to get. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $subscription = ''; - - /** - * @param string $subscription Required. The name of the subscription to get. - * Format is `projects/{project}/subscriptions/{sub}`. Please see - * {@see SubscriberClient::subscriptionName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\GetSubscriptionRequest - * - * @experimental - */ - public static function build(string $subscription): self - { - return (new self()) - ->setSubscription($subscription); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $subscription - * Required. The name of the subscription to get. - * Format is `projects/{project}/subscriptions/{sub}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the subscription to get. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Required. The name of the subscription to get. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSubscription($var) - { - GPBUtil::checkString($var, True); - $this->subscription = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetTopicRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetTopicRequest.php deleted file mode 100644 index 0686a920c4eb..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/GetTopicRequest.php +++ /dev/null @@ -1,86 +0,0 @@ -google.pubsub.v1.GetTopicRequest - */ -class GetTopicRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the topic to get. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $topic = ''; - - /** - * @param string $topic Required. The name of the topic to get. - * Format is `projects/{project}/topics/{topic}`. Please see - * {@see PublisherClient::topicName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\GetTopicRequest - * - * @experimental - */ - public static function build(string $topic): self - { - return (new self()) - ->setTopic($topic); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $topic - * Required. The name of the topic to get. - * Format is `projects/{project}/topics/{topic}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the topic to get. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getTopic() - { - return $this->topic; - } - - /** - * Required. The name of the topic to get. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setTopic($var) - { - GPBUtil::checkString($var, True); - $this->topic = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings.php deleted file mode 100644 index c8f3bd1a0e80..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings.php +++ /dev/null @@ -1,75 +0,0 @@ -google.pubsub.v1.IngestionDataSourceSettings - */ -class IngestionDataSourceSettings extends \Google\Protobuf\Internal\Message -{ - protected $source; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\PubSub\V1\IngestionDataSourceSettings\AwsKinesis $aws_kinesis - * Optional. Amazon Kinesis Data Streams. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. Amazon Kinesis Data Streams. - * - * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\IngestionDataSourceSettings\AwsKinesis|null - */ - public function getAwsKinesis() - { - return $this->readOneof(1); - } - - public function hasAwsKinesis() - { - return $this->hasOneof(1); - } - - /** - * Optional. Amazon Kinesis Data Streams. - * - * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\IngestionDataSourceSettings\AwsKinesis $var - * @return $this - */ - public function setAwsKinesis($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\IngestionDataSourceSettings\AwsKinesis::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * @return string - */ - public function getSource() - { - return $this->whichOneof("source"); - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis.php deleted file mode 100644 index ce30e3b16192..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis.php +++ /dev/null @@ -1,234 +0,0 @@ -google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis - */ -class AwsKinesis extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. An output-only field that indicates the state of the Kinesis - * ingestion source. - * - * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 0; - /** - * Required. The Kinesis stream ARN to ingest data from. - * - * Generated from protobuf field string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $stream_arn = ''; - /** - * Required. The Kinesis consumer ARN to used for ingestion in Enhanced - * Fan-Out mode. The consumer must be already created and ready to be used. - * - * Generated from protobuf field string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $consumer_arn = ''; - /** - * Required. AWS role ARN to be used for Federated Identity authentication - * with Kinesis. Check the Pub/Sub docs for how to set up this role and the - * required permissions that need to be attached to it. - * - * Generated from protobuf field string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $aws_role_arn = ''; - /** - * Required. The GCP service account to be used for Federated Identity - * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for - * the provided role). The `aws_role_arn` must be set up with - * `accounts.google.com:sub` equals to this service account number. - * - * Generated from protobuf field string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $gcp_service_account = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $state - * Output only. An output-only field that indicates the state of the Kinesis - * ingestion source. - * @type string $stream_arn - * Required. The Kinesis stream ARN to ingest data from. - * @type string $consumer_arn - * Required. The Kinesis consumer ARN to used for ingestion in Enhanced - * Fan-Out mode. The consumer must be already created and ready to be used. - * @type string $aws_role_arn - * Required. AWS role ARN to be used for Federated Identity authentication - * with Kinesis. Check the Pub/Sub docs for how to set up this role and the - * required permissions that need to be attached to it. - * @type string $gcp_service_account - * Required. The GCP service account to be used for Federated Identity - * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for - * the provided role). The `aws_role_arn` must be set up with - * `accounts.google.com:sub` equals to this service account number. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Output only. An output-only field that indicates the state of the Kinesis - * ingestion source. - * - * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. An output-only field that indicates the state of the Kinesis - * ingestion source. - * - * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\IngestionDataSourceSettings\AwsKinesis\State::class); - $this->state = $var; - - return $this; - } - - /** - * Required. The Kinesis stream ARN to ingest data from. - * - * Generated from protobuf field string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getStreamArn() - { - return $this->stream_arn; - } - - /** - * Required. The Kinesis stream ARN to ingest data from. - * - * Generated from protobuf field string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setStreamArn($var) - { - GPBUtil::checkString($var, True); - $this->stream_arn = $var; - - return $this; - } - - /** - * Required. The Kinesis consumer ARN to used for ingestion in Enhanced - * Fan-Out mode. The consumer must be already created and ready to be used. - * - * Generated from protobuf field string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getConsumerArn() - { - return $this->consumer_arn; - } - - /** - * Required. The Kinesis consumer ARN to used for ingestion in Enhanced - * Fan-Out mode. The consumer must be already created and ready to be used. - * - * Generated from protobuf field string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setConsumerArn($var) - { - GPBUtil::checkString($var, True); - $this->consumer_arn = $var; - - return $this; - } - - /** - * Required. AWS role ARN to be used for Federated Identity authentication - * with Kinesis. Check the Pub/Sub docs for how to set up this role and the - * required permissions that need to be attached to it. - * - * Generated from protobuf field string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getAwsRoleArn() - { - return $this->aws_role_arn; - } - - /** - * Required. AWS role ARN to be used for Federated Identity authentication - * with Kinesis. Check the Pub/Sub docs for how to set up this role and the - * required permissions that need to be attached to it. - * - * Generated from protobuf field string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setAwsRoleArn($var) - { - GPBUtil::checkString($var, True); - $this->aws_role_arn = $var; - - return $this; - } - - /** - * Required. The GCP service account to be used for Federated Identity - * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for - * the provided role). The `aws_role_arn` must be set up with - * `accounts.google.com:sub` equals to this service account number. - * - * Generated from protobuf field string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getGcpServiceAccount() - { - return $this->gcp_service_account; - } - - /** - * Required. The GCP service account to be used for Federated Identity - * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for - * the provided role). The `aws_role_arn` must be set up with - * `accounts.google.com:sub` equals to this service account number. - * - * Generated from protobuf field string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setGcpServiceAccount($var) - { - GPBUtil::checkString($var, True); - $this->gcp_service_account = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(AwsKinesis::class, \Google\Cloud\PubSub\V1\IngestionDataSourceSettings_AwsKinesis::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis/State.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis/State.php deleted file mode 100644 index b53ce8c6788f..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/IngestionDataSourceSettings/AwsKinesis/State.php +++ /dev/null @@ -1,95 +0,0 @@ -google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State - */ -class State -{ - /** - * Default value. This value is unused. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * Ingestion is active. - * - * Generated from protobuf enum ACTIVE = 1; - */ - const ACTIVE = 1; - /** - * Permission denied encountered while consuming data from Kinesis. - * This can happen if: - * - The provided `aws_role_arn` does not exist or does not have the - * appropriate permissions attached. - * - The provided `aws_role_arn` is not set up properly for Identity - * Federation using `gcp_service_account`. - * - The Pub/Sub SA is not granted the - * `iam.serviceAccounts.getOpenIdToken` permission on - * `gcp_service_account`. - * - * Generated from protobuf enum KINESIS_PERMISSION_DENIED = 2; - */ - const KINESIS_PERMISSION_DENIED = 2; - /** - * Permission denied encountered while publishing to the topic. This can - * happen if the Pub/Sub SA has not been granted the [appropriate publish - * permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher) - * - * Generated from protobuf enum PUBLISH_PERMISSION_DENIED = 3; - */ - const PUBLISH_PERMISSION_DENIED = 3; - /** - * The Kinesis stream does not exist. - * - * Generated from protobuf enum STREAM_NOT_FOUND = 4; - */ - const STREAM_NOT_FOUND = 4; - /** - * The Kinesis consumer does not exist. - * - * Generated from protobuf enum CONSUMER_NOT_FOUND = 5; - */ - const CONSUMER_NOT_FOUND = 5; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::ACTIVE => 'ACTIVE', - self::KINESIS_PERMISSION_DENIED => 'KINESIS_PERMISSION_DENIED', - self::PUBLISH_PERMISSION_DENIED => 'PUBLISH_PERMISSION_DENIED', - self::STREAM_NOT_FOUND => 'STREAM_NOT_FOUND', - self::CONSUMER_NOT_FOUND => 'CONSUMER_NOT_FOUND', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\PubSub\V1\IngestionDataSourceSettings_AwsKinesis_State::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsRequest.php deleted file mode 100644 index b9f24a77534d..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsRequest.php +++ /dev/null @@ -1,195 +0,0 @@ -google.pubsub.v1.ListSchemaRevisionsRequest - */ -class ListSchemaRevisionsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the schema to list revisions for. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * - * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; - */ - protected $view = 0; - /** - * The maximum number of revisions to return per page. - * - * Generated from protobuf field int32 page_size = 3; - */ - protected $page_size = 0; - /** - * The page token, received from a previous ListSchemaRevisions call. - * Provide this to retrieve the subsequent page. - * - * Generated from protobuf field string page_token = 4; - */ - protected $page_token = ''; - - /** - * @param string $name Required. The name of the schema to list revisions for. Please see - * {@see SchemaServiceClient::schemaName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\ListSchemaRevisionsRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the schema to list revisions for. - * @type int $view - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * @type int $page_size - * The maximum number of revisions to return per page. - * @type string $page_token - * The page token, received from a previous ListSchemaRevisions call. - * Provide this to retrieve the subsequent page. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the schema to list revisions for. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the schema to list revisions for. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * - * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; - * @return int - */ - public function getView() - { - return $this->view; - } - - /** - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * - * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; - * @param int $var - * @return $this - */ - public function setView($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\SchemaView::class); - $this->view = $var; - - return $this; - } - - /** - * The maximum number of revisions to return per page. - * - * Generated from protobuf field int32 page_size = 3; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * The maximum number of revisions to return per page. - * - * Generated from protobuf field int32 page_size = 3; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * The page token, received from a previous ListSchemaRevisions call. - * Provide this to retrieve the subsequent page. - * - * Generated from protobuf field string page_token = 4; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * The page token, received from a previous ListSchemaRevisions call. - * Provide this to retrieve the subsequent page. - * - * Generated from protobuf field string page_token = 4; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsResponse.php deleted file mode 100644 index 634dc721e15d..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemaRevisionsResponse.php +++ /dev/null @@ -1,105 +0,0 @@ -google.pubsub.v1.ListSchemaRevisionsResponse - */ -class ListSchemaRevisionsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The revisions of the schema. - * - * Generated from protobuf field repeated .google.pubsub.v1.Schema schemas = 1; - */ - private $schemas; - /** - * A token that can be sent as `page_token` to retrieve the next page. - * If this field is empty, there are no subsequent pages. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\PubSub\V1\Schema>|\Google\Protobuf\Internal\RepeatedField $schemas - * The revisions of the schema. - * @type string $next_page_token - * A token that can be sent as `page_token` to retrieve the next page. - * If this field is empty, there are no subsequent pages. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - - /** - * The revisions of the schema. - * - * Generated from protobuf field repeated .google.pubsub.v1.Schema schemas = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSchemas() - { - return $this->schemas; - } - - /** - * The revisions of the schema. - * - * Generated from protobuf field repeated .google.pubsub.v1.Schema schemas = 1; - * @param array<\Google\Cloud\PubSub\V1\Schema>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSchemas($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\Schema::class); - $this->schemas = $arr; - - return $this; - } - - /** - * A token that can be sent as `page_token` to retrieve the next page. - * If this field is empty, there are no subsequent pages. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * A token that can be sent as `page_token` to retrieve the next page. - * If this field is empty, there are no subsequent pages. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasRequest.php deleted file mode 100644 index 32b97def03fc..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasRequest.php +++ /dev/null @@ -1,204 +0,0 @@ -google.pubsub.v1.ListSchemasRequest - */ -class ListSchemasRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the project in which to list schemas. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * - * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; - */ - protected $view = 0; - /** - * Maximum number of schemas to return. - * - * Generated from protobuf field int32 page_size = 3; - */ - protected $page_size = 0; - /** - * The value returned by the last `ListSchemasResponse`; indicates that - * this is a continuation of a prior `ListSchemas` call, and that the - * system should return the next page of data. - * - * Generated from protobuf field string page_token = 4; - */ - protected $page_token = ''; - - /** - * @param string $parent Required. The name of the project in which to list schemas. - * Format is `projects/{project-id}`. Please see - * {@see SchemaServiceClient::projectName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\ListSchemasRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the project in which to list schemas. - * Format is `projects/{project-id}`. - * @type int $view - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * @type int $page_size - * Maximum number of schemas to return. - * @type string $page_token - * The value returned by the last `ListSchemasResponse`; indicates that - * this is a continuation of a prior `ListSchemas` call, and that the - * system should return the next page of data. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the project in which to list schemas. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the project in which to list schemas. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * - * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; - * @return int - */ - public function getView() - { - return $this->view; - } - - /** - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * - * Generated from protobuf field .google.pubsub.v1.SchemaView view = 2; - * @param int $var - * @return $this - */ - public function setView($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\SchemaView::class); - $this->view = $var; - - return $this; - } - - /** - * Maximum number of schemas to return. - * - * Generated from protobuf field int32 page_size = 3; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Maximum number of schemas to return. - * - * Generated from protobuf field int32 page_size = 3; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * The value returned by the last `ListSchemasResponse`; indicates that - * this is a continuation of a prior `ListSchemas` call, and that the - * system should return the next page of data. - * - * Generated from protobuf field string page_token = 4; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * The value returned by the last `ListSchemasResponse`; indicates that - * this is a continuation of a prior `ListSchemas` call, and that the - * system should return the next page of data. - * - * Generated from protobuf field string page_token = 4; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasResponse.php deleted file mode 100644 index c61109d326dc..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSchemasResponse.php +++ /dev/null @@ -1,105 +0,0 @@ -google.pubsub.v1.ListSchemasResponse - */ -class ListSchemasResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The resulting schemas. - * - * Generated from protobuf field repeated .google.pubsub.v1.Schema schemas = 1; - */ - private $schemas; - /** - * If not empty, indicates that there may be more schemas that match the - * request; this value should be passed in a new `ListSchemasRequest`. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\PubSub\V1\Schema>|\Google\Protobuf\Internal\RepeatedField $schemas - * The resulting schemas. - * @type string $next_page_token - * If not empty, indicates that there may be more schemas that match the - * request; this value should be passed in a new `ListSchemasRequest`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - - /** - * The resulting schemas. - * - * Generated from protobuf field repeated .google.pubsub.v1.Schema schemas = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSchemas() - { - return $this->schemas; - } - - /** - * The resulting schemas. - * - * Generated from protobuf field repeated .google.pubsub.v1.Schema schemas = 1; - * @param array<\Google\Cloud\PubSub\V1\Schema>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSchemas($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\Schema::class); - $this->schemas = $arr; - - return $this; - } - - /** - * If not empty, indicates that there may be more schemas that match the - * request; this value should be passed in a new `ListSchemasRequest`. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * If not empty, indicates that there may be more schemas that match the - * request; this value should be passed in a new `ListSchemasRequest`. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsRequest.php deleted file mode 100644 index b0bbf7bdb442..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsRequest.php +++ /dev/null @@ -1,162 +0,0 @@ -google.pubsub.v1.ListSnapshotsRequest - */ -class ListSnapshotsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the project in which to list snapshots. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $project = ''; - /** - * Optional. Maximum number of snapshots to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_size = 0; - /** - * Optional. The value returned by the last `ListSnapshotsResponse`; indicates - * that this is a continuation of a prior `ListSnapshots` call, and that the - * system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_token = ''; - - /** - * @param string $project Required. The name of the project in which to list snapshots. - * Format is `projects/{project-id}`. Please see - * {@see SubscriberClient::projectName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\ListSnapshotsRequest - * - * @experimental - */ - public static function build(string $project): self - { - return (new self()) - ->setProject($project); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $project - * Required. The name of the project in which to list snapshots. - * Format is `projects/{project-id}`. - * @type int $page_size - * Optional. Maximum number of snapshots to return. - * @type string $page_token - * Optional. The value returned by the last `ListSnapshotsResponse`; indicates - * that this is a continuation of a prior `ListSnapshots` call, and that the - * system should return the next page of data. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the project in which to list snapshots. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getProject() - { - return $this->project; - } - - /** - * Required. The name of the project in which to list snapshots. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setProject($var) - { - GPBUtil::checkString($var, True); - $this->project = $var; - - return $this; - } - - /** - * Optional. Maximum number of snapshots to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Optional. Maximum number of snapshots to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * Optional. The value returned by the last `ListSnapshotsResponse`; indicates - * that this is a continuation of a prior `ListSnapshots` call, and that the - * system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * Optional. The value returned by the last `ListSnapshotsResponse`; indicates - * that this is a continuation of a prior `ListSnapshots` call, and that the - * system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsResponse.php deleted file mode 100644 index caf5bbb50e34..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSnapshotsResponse.php +++ /dev/null @@ -1,109 +0,0 @@ -google.pubsub.v1.ListSnapshotsResponse - */ -class ListSnapshotsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. The resulting snapshots. - * - * Generated from protobuf field repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $snapshots; - /** - * Optional. If not empty, indicates that there may be more snapshot that - * match the request; this value should be passed in a new - * `ListSnapshotsRequest`. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\PubSub\V1\Snapshot>|\Google\Protobuf\Internal\RepeatedField $snapshots - * Optional. The resulting snapshots. - * @type string $next_page_token - * Optional. If not empty, indicates that there may be more snapshot that - * match the request; this value should be passed in a new - * `ListSnapshotsRequest`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. The resulting snapshots. - * - * Generated from protobuf field repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSnapshots() - { - return $this->snapshots; - } - - /** - * Optional. The resulting snapshots. - * - * Generated from protobuf field repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param array<\Google\Cloud\PubSub\V1\Snapshot>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSnapshots($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\Snapshot::class); - $this->snapshots = $arr; - - return $this; - } - - /** - * Optional. If not empty, indicates that there may be more snapshot that - * match the request; this value should be passed in a new - * `ListSnapshotsRequest`. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * Optional. If not empty, indicates that there may be more snapshot that - * match the request; this value should be passed in a new - * `ListSnapshotsRequest`. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsRequest.php deleted file mode 100644 index d1cce8a45b0e..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsRequest.php +++ /dev/null @@ -1,162 +0,0 @@ -google.pubsub.v1.ListSubscriptionsRequest - */ -class ListSubscriptionsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the project in which to list subscriptions. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $project = ''; - /** - * Optional. Maximum number of subscriptions to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_size = 0; - /** - * Optional. The value returned by the last `ListSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListSubscriptions` call, - * and that the system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_token = ''; - - /** - * @param string $project Required. The name of the project in which to list subscriptions. - * Format is `projects/{project-id}`. Please see - * {@see SubscriberClient::projectName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\ListSubscriptionsRequest - * - * @experimental - */ - public static function build(string $project): self - { - return (new self()) - ->setProject($project); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $project - * Required. The name of the project in which to list subscriptions. - * Format is `projects/{project-id}`. - * @type int $page_size - * Optional. Maximum number of subscriptions to return. - * @type string $page_token - * Optional. The value returned by the last `ListSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListSubscriptions` call, - * and that the system should return the next page of data. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the project in which to list subscriptions. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getProject() - { - return $this->project; - } - - /** - * Required. The name of the project in which to list subscriptions. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setProject($var) - { - GPBUtil::checkString($var, True); - $this->project = $var; - - return $this; - } - - /** - * Optional. Maximum number of subscriptions to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Optional. Maximum number of subscriptions to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * Optional. The value returned by the last `ListSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListSubscriptions` call, - * and that the system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * Optional. The value returned by the last `ListSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListSubscriptions` call, - * and that the system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsResponse.php deleted file mode 100644 index e875730c48cc..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListSubscriptionsResponse.php +++ /dev/null @@ -1,109 +0,0 @@ -google.pubsub.v1.ListSubscriptionsResponse - */ -class ListSubscriptionsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. The subscriptions that match the request. - * - * Generated from protobuf field repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $subscriptions; - /** - * Optional. If not empty, indicates that there may be more subscriptions that - * match the request; this value should be passed in a new - * `ListSubscriptionsRequest` to get more subscriptions. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\PubSub\V1\Subscription>|\Google\Protobuf\Internal\RepeatedField $subscriptions - * Optional. The subscriptions that match the request. - * @type string $next_page_token - * Optional. If not empty, indicates that there may be more subscriptions that - * match the request; this value should be passed in a new - * `ListSubscriptionsRequest` to get more subscriptions. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. The subscriptions that match the request. - * - * Generated from protobuf field repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSubscriptions() - { - return $this->subscriptions; - } - - /** - * Optional. The subscriptions that match the request. - * - * Generated from protobuf field repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param array<\Google\Cloud\PubSub\V1\Subscription>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSubscriptions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\Subscription::class); - $this->subscriptions = $arr; - - return $this; - } - - /** - * Optional. If not empty, indicates that there may be more subscriptions that - * match the request; this value should be passed in a new - * `ListSubscriptionsRequest` to get more subscriptions. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * Optional. If not empty, indicates that there may be more subscriptions that - * match the request; this value should be passed in a new - * `ListSubscriptionsRequest` to get more subscriptions. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsRequest.php deleted file mode 100644 index be1957c835c0..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsRequest.php +++ /dev/null @@ -1,162 +0,0 @@ -google.pubsub.v1.ListTopicSnapshotsRequest - */ -class ListTopicSnapshotsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the topic that snapshots are attached to. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $topic = ''; - /** - * Optional. Maximum number of snapshot names to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_size = 0; - /** - * Optional. The value returned by the last `ListTopicSnapshotsResponse`; - * indicates that this is a continuation of a prior `ListTopicSnapshots` call, - * and that the system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_token = ''; - - /** - * @param string $topic Required. The name of the topic that snapshots are attached to. - * Format is `projects/{project}/topics/{topic}`. Please see - * {@see PublisherClient::topicName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\ListTopicSnapshotsRequest - * - * @experimental - */ - public static function build(string $topic): self - { - return (new self()) - ->setTopic($topic); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $topic - * Required. The name of the topic that snapshots are attached to. - * Format is `projects/{project}/topics/{topic}`. - * @type int $page_size - * Optional. Maximum number of snapshot names to return. - * @type string $page_token - * Optional. The value returned by the last `ListTopicSnapshotsResponse`; - * indicates that this is a continuation of a prior `ListTopicSnapshots` call, - * and that the system should return the next page of data. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the topic that snapshots are attached to. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getTopic() - { - return $this->topic; - } - - /** - * Required. The name of the topic that snapshots are attached to. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setTopic($var) - { - GPBUtil::checkString($var, True); - $this->topic = $var; - - return $this; - } - - /** - * Optional. Maximum number of snapshot names to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Optional. Maximum number of snapshot names to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * Optional. The value returned by the last `ListTopicSnapshotsResponse`; - * indicates that this is a continuation of a prior `ListTopicSnapshots` call, - * and that the system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * Optional. The value returned by the last `ListTopicSnapshotsResponse`; - * indicates that this is a continuation of a prior `ListTopicSnapshots` call, - * and that the system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsResponse.php deleted file mode 100644 index cb08491e5665..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSnapshotsResponse.php +++ /dev/null @@ -1,109 +0,0 @@ -google.pubsub.v1.ListTopicSnapshotsResponse - */ -class ListTopicSnapshotsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. The names of the snapshots that match the request. - * - * Generated from protobuf field repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $snapshots; - /** - * Optional. If not empty, indicates that there may be more snapshots that - * match the request; this value should be passed in a new - * `ListTopicSnapshotsRequest` to get more snapshots. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $snapshots - * Optional. The names of the snapshots that match the request. - * @type string $next_page_token - * Optional. If not empty, indicates that there may be more snapshots that - * match the request; this value should be passed in a new - * `ListTopicSnapshotsRequest` to get more snapshots. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. The names of the snapshots that match the request. - * - * Generated from protobuf field repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSnapshots() - { - return $this->snapshots; - } - - /** - * Optional. The names of the snapshots that match the request. - * - * Generated from protobuf field repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSnapshots($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->snapshots = $arr; - - return $this; - } - - /** - * Optional. If not empty, indicates that there may be more snapshots that - * match the request; this value should be passed in a new - * `ListTopicSnapshotsRequest` to get more snapshots. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * Optional. If not empty, indicates that there may be more snapshots that - * match the request; this value should be passed in a new - * `ListTopicSnapshotsRequest` to get more snapshots. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsRequest.php deleted file mode 100644 index 2a3775252ebc..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsRequest.php +++ /dev/null @@ -1,162 +0,0 @@ -google.pubsub.v1.ListTopicSubscriptionsRequest - */ -class ListTopicSubscriptionsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the topic that subscriptions are attached to. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $topic = ''; - /** - * Optional. Maximum number of subscription names to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_size = 0; - /** - * Optional. The value returned by the last `ListTopicSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListTopicSubscriptions` - * call, and that the system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_token = ''; - - /** - * @param string $topic Required. The name of the topic that subscriptions are attached to. - * Format is `projects/{project}/topics/{topic}`. Please see - * {@see PublisherClient::topicName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\ListTopicSubscriptionsRequest - * - * @experimental - */ - public static function build(string $topic): self - { - return (new self()) - ->setTopic($topic); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $topic - * Required. The name of the topic that subscriptions are attached to. - * Format is `projects/{project}/topics/{topic}`. - * @type int $page_size - * Optional. Maximum number of subscription names to return. - * @type string $page_token - * Optional. The value returned by the last `ListTopicSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListTopicSubscriptions` - * call, and that the system should return the next page of data. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the topic that subscriptions are attached to. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getTopic() - { - return $this->topic; - } - - /** - * Required. The name of the topic that subscriptions are attached to. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setTopic($var) - { - GPBUtil::checkString($var, True); - $this->topic = $var; - - return $this; - } - - /** - * Optional. Maximum number of subscription names to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Optional. Maximum number of subscription names to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * Optional. The value returned by the last `ListTopicSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListTopicSubscriptions` - * call, and that the system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * Optional. The value returned by the last `ListTopicSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListTopicSubscriptions` - * call, and that the system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsResponse.php deleted file mode 100644 index 2b7f1c2324e4..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicSubscriptionsResponse.php +++ /dev/null @@ -1,113 +0,0 @@ -google.pubsub.v1.ListTopicSubscriptionsResponse - */ -class ListTopicSubscriptionsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. The names of subscriptions attached to the topic specified in the - * request. - * - * Generated from protobuf field repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - */ - private $subscriptions; - /** - * Optional. If not empty, indicates that there may be more subscriptions that - * match the request; this value should be passed in a new - * `ListTopicSubscriptionsRequest` to get more subscriptions. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $subscriptions - * Optional. The names of subscriptions attached to the topic specified in the - * request. - * @type string $next_page_token - * Optional. If not empty, indicates that there may be more subscriptions that - * match the request; this value should be passed in a new - * `ListTopicSubscriptionsRequest` to get more subscriptions. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. The names of subscriptions attached to the topic specified in the - * request. - * - * Generated from protobuf field repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSubscriptions() - { - return $this->subscriptions; - } - - /** - * Optional. The names of subscriptions attached to the topic specified in the - * request. - * - * Generated from protobuf field repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSubscriptions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->subscriptions = $arr; - - return $this; - } - - /** - * Optional. If not empty, indicates that there may be more subscriptions that - * match the request; this value should be passed in a new - * `ListTopicSubscriptionsRequest` to get more subscriptions. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * Optional. If not empty, indicates that there may be more subscriptions that - * match the request; this value should be passed in a new - * `ListTopicSubscriptionsRequest` to get more subscriptions. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsRequest.php deleted file mode 100644 index fe2336bce34b..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsRequest.php +++ /dev/null @@ -1,162 +0,0 @@ -google.pubsub.v1.ListTopicsRequest - */ -class ListTopicsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the project in which to list topics. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $project = ''; - /** - * Optional. Maximum number of topics to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_size = 0; - /** - * Optional. The value returned by the last `ListTopicsResponse`; indicates - * that this is a continuation of a prior `ListTopics` call, and that the - * system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_token = ''; - - /** - * @param string $project Required. The name of the project in which to list topics. - * Format is `projects/{project-id}`. Please see - * {@see PublisherClient::projectName()} for help formatting this field. - * - * @return \Google\Cloud\PubSub\V1\ListTopicsRequest - * - * @experimental - */ - public static function build(string $project): self - { - return (new self()) - ->setProject($project); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $project - * Required. The name of the project in which to list topics. - * Format is `projects/{project-id}`. - * @type int $page_size - * Optional. Maximum number of topics to return. - * @type string $page_token - * Optional. The value returned by the last `ListTopicsResponse`; indicates - * that this is a continuation of a prior `ListTopics` call, and that the - * system should return the next page of data. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the project in which to list topics. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getProject() - { - return $this->project; - } - - /** - * Required. The name of the project in which to list topics. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setProject($var) - { - GPBUtil::checkString($var, True); - $this->project = $var; - - return $this; - } - - /** - * Optional. Maximum number of topics to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Optional. Maximum number of topics to return. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * Optional. The value returned by the last `ListTopicsResponse`; indicates - * that this is a continuation of a prior `ListTopics` call, and that the - * system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * Optional. The value returned by the last `ListTopicsResponse`; indicates - * that this is a continuation of a prior `ListTopics` call, and that the - * system should return the next page of data. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsResponse.php deleted file mode 100644 index 79a07799e342..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ListTopicsResponse.php +++ /dev/null @@ -1,105 +0,0 @@ -google.pubsub.v1.ListTopicsResponse - */ -class ListTopicsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. The resulting topics. - * - * Generated from protobuf field repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $topics; - /** - * Optional. If not empty, indicates that there may be more topics that match - * the request; this value should be passed in a new `ListTopicsRequest`. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\PubSub\V1\Topic>|\Google\Protobuf\Internal\RepeatedField $topics - * Optional. The resulting topics. - * @type string $next_page_token - * Optional. If not empty, indicates that there may be more topics that match - * the request; this value should be passed in a new `ListTopicsRequest`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. The resulting topics. - * - * Generated from protobuf field repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getTopics() - { - return $this->topics; - } - - /** - * Optional. The resulting topics. - * - * Generated from protobuf field repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param array<\Google\Cloud\PubSub\V1\Topic>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setTopics($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\Topic::class); - $this->topics = $arr; - - return $this; - } - - /** - * Optional. If not empty, indicates that there may be more topics that match - * the request; this value should be passed in a new `ListTopicsRequest`. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * Optional. If not empty, indicates that there may be more topics that match - * the request; this value should be passed in a new `ListTopicsRequest`. - * - * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/MessageStoragePolicy.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/MessageStoragePolicy.php deleted file mode 100644 index b31b0ad03911..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/MessageStoragePolicy.php +++ /dev/null @@ -1,137 +0,0 @@ -google.pubsub.v1.MessageStoragePolicy - */ -class MessageStoragePolicy extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. A list of IDs of Google Cloud regions where messages that are - * published to the topic may be persisted in storage. Messages published by - * publishers running in non-allowed Google Cloud regions (or running outside - * of Google Cloud altogether) are routed for storage in one of the allowed - * regions. An empty list means that no regions are allowed, and is not a - * valid configuration. - * - * Generated from protobuf field repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $allowed_persistence_regions; - /** - * Optional. If true, `allowed_persistence_regions` is also used to enforce - * in-transit guarantees for messages. That is, Pub/Sub will fail - * Publish operations on this topic and subscribe operations - * on any subscription attached to this topic in any region that is - * not in `allowed_persistence_regions`. - * - * Generated from protobuf field bool enforce_in_transit = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $enforce_in_transit = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $allowed_persistence_regions - * Optional. A list of IDs of Google Cloud regions where messages that are - * published to the topic may be persisted in storage. Messages published by - * publishers running in non-allowed Google Cloud regions (or running outside - * of Google Cloud altogether) are routed for storage in one of the allowed - * regions. An empty list means that no regions are allowed, and is not a - * valid configuration. - * @type bool $enforce_in_transit - * Optional. If true, `allowed_persistence_regions` is also used to enforce - * in-transit guarantees for messages. That is, Pub/Sub will fail - * Publish operations on this topic and subscribe operations - * on any subscription attached to this topic in any region that is - * not in `allowed_persistence_regions`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. A list of IDs of Google Cloud regions where messages that are - * published to the topic may be persisted in storage. Messages published by - * publishers running in non-allowed Google Cloud regions (or running outside - * of Google Cloud altogether) are routed for storage in one of the allowed - * regions. An empty list means that no regions are allowed, and is not a - * valid configuration. - * - * Generated from protobuf field repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getAllowedPersistenceRegions() - { - return $this->allowed_persistence_regions; - } - - /** - * Optional. A list of IDs of Google Cloud regions where messages that are - * published to the topic may be persisted in storage. Messages published by - * publishers running in non-allowed Google Cloud regions (or running outside - * of Google Cloud altogether) are routed for storage in one of the allowed - * regions. An empty list means that no regions are allowed, and is not a - * valid configuration. - * - * Generated from protobuf field repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setAllowedPersistenceRegions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->allowed_persistence_regions = $arr; - - return $this; - } - - /** - * Optional. If true, `allowed_persistence_regions` is also used to enforce - * in-transit guarantees for messages. That is, Pub/Sub will fail - * Publish operations on this topic and subscribe operations - * on any subscription attached to this topic in any region that is - * not in `allowed_persistence_regions`. - * - * Generated from protobuf field bool enforce_in_transit = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getEnforceInTransit() - { - return $this->enforce_in_transit; - } - - /** - * Optional. If true, `allowed_persistence_regions` is also used to enforce - * in-transit guarantees for messages. That is, Pub/Sub will fail - * Publish operations on this topic and subscribe operations - * on any subscription attached to this topic in any region that is - * not in `allowed_persistence_regions`. - * - * Generated from protobuf field bool enforce_in_transit = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setEnforceInTransit($var) - { - GPBUtil::checkBool($var); - $this->enforce_in_transit = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyAckDeadlineRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyAckDeadlineRequest.php deleted file mode 100644 index 91c8c3e18e23..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyAckDeadlineRequest.php +++ /dev/null @@ -1,198 +0,0 @@ -google.pubsub.v1.ModifyAckDeadlineRequest - */ -class ModifyAckDeadlineRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $subscription = ''; - /** - * Required. List of acknowledgment IDs. - * - * Generated from protobuf field repeated string ack_ids = 4 [(.google.api.field_behavior) = REQUIRED]; - */ - private $ack_ids; - /** - * Required. The new ack deadline with respect to the time this request was - * sent to the Pub/Sub system. For example, if the value is 10, the new ack - * deadline will expire 10 seconds after the `ModifyAckDeadline` call was - * made. Specifying zero might immediately make the message available for - * delivery to another subscriber client. This typically results in an - * increase in the rate of message redeliveries (that is, duplicates). - * The minimum deadline you can specify is 0 seconds. - * The maximum deadline you can specify in a single request is 600 seconds - * (10 minutes). - * - * Generated from protobuf field int32 ack_deadline_seconds = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $ack_deadline_seconds = 0; - - /** - * @param string $subscription Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. Please see - * {@see SubscriberClient::subscriptionName()} for help formatting this field. - * @param string[] $ackIds Required. List of acknowledgment IDs. - * @param int $ackDeadlineSeconds Required. The new ack deadline with respect to the time this request was - * sent to the Pub/Sub system. For example, if the value is 10, the new ack - * deadline will expire 10 seconds after the `ModifyAckDeadline` call was - * made. Specifying zero might immediately make the message available for - * delivery to another subscriber client. This typically results in an - * increase in the rate of message redeliveries (that is, duplicates). - * The minimum deadline you can specify is 0 seconds. - * The maximum deadline you can specify in a single request is 600 seconds - * (10 minutes). - * - * @return \Google\Cloud\PubSub\V1\ModifyAckDeadlineRequest - * - * @experimental - */ - public static function build(string $subscription, array $ackIds, int $ackDeadlineSeconds): self - { - return (new self()) - ->setSubscription($subscription) - ->setAckIds($ackIds) - ->setAckDeadlineSeconds($ackDeadlineSeconds); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $subscription - * Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. - * @type array|\Google\Protobuf\Internal\RepeatedField $ack_ids - * Required. List of acknowledgment IDs. - * @type int $ack_deadline_seconds - * Required. The new ack deadline with respect to the time this request was - * sent to the Pub/Sub system. For example, if the value is 10, the new ack - * deadline will expire 10 seconds after the `ModifyAckDeadline` call was - * made. Specifying zero might immediately make the message available for - * delivery to another subscriber client. This typically results in an - * increase in the rate of message redeliveries (that is, duplicates). - * The minimum deadline you can specify is 0 seconds. - * The maximum deadline you can specify in a single request is 600 seconds - * (10 minutes). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSubscription($var) - { - GPBUtil::checkString($var, True); - $this->subscription = $var; - - return $this; - } - - /** - * Required. List of acknowledgment IDs. - * - * Generated from protobuf field repeated string ack_ids = 4 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getAckIds() - { - return $this->ack_ids; - } - - /** - * Required. List of acknowledgment IDs. - * - * Generated from protobuf field repeated string ack_ids = 4 [(.google.api.field_behavior) = REQUIRED]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setAckIds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->ack_ids = $arr; - - return $this; - } - - /** - * Required. The new ack deadline with respect to the time this request was - * sent to the Pub/Sub system. For example, if the value is 10, the new ack - * deadline will expire 10 seconds after the `ModifyAckDeadline` call was - * made. Specifying zero might immediately make the message available for - * delivery to another subscriber client. This typically results in an - * increase in the rate of message redeliveries (that is, duplicates). - * The minimum deadline you can specify is 0 seconds. - * The maximum deadline you can specify in a single request is 600 seconds - * (10 minutes). - * - * Generated from protobuf field int32 ack_deadline_seconds = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return int - */ - public function getAckDeadlineSeconds() - { - return $this->ack_deadline_seconds; - } - - /** - * Required. The new ack deadline with respect to the time this request was - * sent to the Pub/Sub system. For example, if the value is 10, the new ack - * deadline will expire 10 seconds after the `ModifyAckDeadline` call was - * made. Specifying zero might immediately make the message available for - * delivery to another subscriber client. This typically results in an - * increase in the rate of message redeliveries (that is, duplicates). - * The minimum deadline you can specify is 0 seconds. - * The maximum deadline you can specify in a single request is 600 seconds - * (10 minutes). - * - * Generated from protobuf field int32 ack_deadline_seconds = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param int $var - * @return $this - */ - public function setAckDeadlineSeconds($var) - { - GPBUtil::checkInt32($var); - $this->ack_deadline_seconds = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyPushConfigRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyPushConfigRequest.php deleted file mode 100644 index 7a2f636dcaf1..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ModifyPushConfigRequest.php +++ /dev/null @@ -1,153 +0,0 @@ -google.pubsub.v1.ModifyPushConfigRequest - */ -class ModifyPushConfigRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $subscription = ''; - /** - * Required. The push configuration for future deliveries. - * An empty `pushConfig` indicates that the Pub/Sub system should - * stop pushing messages from the given subscription and allow - * messages to be pulled and acknowledged - effectively pausing - * the subscription if `Pull` or `StreamingPull` is not called. - * - * Generated from protobuf field .google.pubsub.v1.PushConfig push_config = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $push_config = null; - - /** - * @param string $subscription Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. Please see - * {@see SubscriberClient::subscriptionName()} for help formatting this field. - * @param \Google\Cloud\PubSub\V1\PushConfig $pushConfig Required. The push configuration for future deliveries. - * - * An empty `pushConfig` indicates that the Pub/Sub system should - * stop pushing messages from the given subscription and allow - * messages to be pulled and acknowledged - effectively pausing - * the subscription if `Pull` or `StreamingPull` is not called. - * - * @return \Google\Cloud\PubSub\V1\ModifyPushConfigRequest - * - * @experimental - */ - public static function build(string $subscription, \Google\Cloud\PubSub\V1\PushConfig $pushConfig): self - { - return (new self()) - ->setSubscription($subscription) - ->setPushConfig($pushConfig); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $subscription - * Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. - * @type \Google\Cloud\PubSub\V1\PushConfig $push_config - * Required. The push configuration for future deliveries. - * An empty `pushConfig` indicates that the Pub/Sub system should - * stop pushing messages from the given subscription and allow - * messages to be pulled and acknowledged - effectively pausing - * the subscription if `Pull` or `StreamingPull` is not called. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSubscription($var) - { - GPBUtil::checkString($var, True); - $this->subscription = $var; - - return $this; - } - - /** - * Required. The push configuration for future deliveries. - * An empty `pushConfig` indicates that the Pub/Sub system should - * stop pushing messages from the given subscription and allow - * messages to be pulled and acknowledged - effectively pausing - * the subscription if `Pull` or `StreamingPull` is not called. - * - * Generated from protobuf field .google.pubsub.v1.PushConfig push_config = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\PubSub\V1\PushConfig|null - */ - public function getPushConfig() - { - return $this->push_config; - } - - public function hasPushConfig() - { - return isset($this->push_config); - } - - public function clearPushConfig() - { - unset($this->push_config); - } - - /** - * Required. The push configuration for future deliveries. - * An empty `pushConfig` indicates that the Pub/Sub system should - * stop pushing messages from the given subscription and allow - * messages to be pulled and acknowledged - effectively pausing - * the subscription if `Pull` or `StreamingPull` is not called. - * - * Generated from protobuf field .google.pubsub.v1.PushConfig push_config = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\PubSub\V1\PushConfig $var - * @return $this - */ - public function setPushConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PushConfig::class); - $this->push_config = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishRequest.php deleted file mode 100644 index c548ceb7fcb5..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishRequest.php +++ /dev/null @@ -1,122 +0,0 @@ -google.pubsub.v1.PublishRequest - */ -class PublishRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The messages in the request will be published on this topic. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $topic = ''; - /** - * Required. The messages to publish. - * - * Generated from protobuf field repeated .google.pubsub.v1.PubsubMessage messages = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - private $messages; - - /** - * @param string $topic Required. The messages in the request will be published on this topic. - * Format is `projects/{project}/topics/{topic}`. Please see - * {@see PublisherClient::topicName()} for help formatting this field. - * @param \Google\Cloud\PubSub\V1\PubsubMessage[] $messages Required. The messages to publish. - * - * @return \Google\Cloud\PubSub\V1\PublishRequest - * - * @experimental - */ - public static function build(string $topic, array $messages): self - { - return (new self()) - ->setTopic($topic) - ->setMessages($messages); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $topic - * Required. The messages in the request will be published on this topic. - * Format is `projects/{project}/topics/{topic}`. - * @type array<\Google\Cloud\PubSub\V1\PubsubMessage>|\Google\Protobuf\Internal\RepeatedField $messages - * Required. The messages to publish. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The messages in the request will be published on this topic. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getTopic() - { - return $this->topic; - } - - /** - * Required. The messages in the request will be published on this topic. - * Format is `projects/{project}/topics/{topic}`. - * - * Generated from protobuf field string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setTopic($var) - { - GPBUtil::checkString($var, True); - $this->topic = $var; - - return $this; - } - - /** - * Required. The messages to publish. - * - * Generated from protobuf field repeated .google.pubsub.v1.PubsubMessage messages = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getMessages() - { - return $this->messages; - } - - /** - * Required. The messages to publish. - * - * Generated from protobuf field repeated .google.pubsub.v1.PubsubMessage messages = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param array<\Google\Cloud\PubSub\V1\PubsubMessage>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setMessages($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\PubsubMessage::class); - $this->messages = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishResponse.php deleted file mode 100644 index c36633c7d984..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PublishResponse.php +++ /dev/null @@ -1,75 +0,0 @@ -google.pubsub.v1.PublishResponse - */ -class PublishResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. The server-assigned ID of each published message, in the same - * order as the messages in the request. IDs are guaranteed to be unique - * within the topic. - * - * Generated from protobuf field repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $message_ids; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $message_ids - * Optional. The server-assigned ID of each published message, in the same - * order as the messages in the request. IDs are guaranteed to be unique - * within the topic. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. The server-assigned ID of each published message, in the same - * order as the messages in the request. IDs are guaranteed to be unique - * within the topic. - * - * Generated from protobuf field repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getMessageIds() - { - return $this->message_ids; - } - - /** - * Optional. The server-assigned ID of each published message, in the same - * order as the messages in the request. IDs are guaranteed to be unique - * within the topic. - * - * Generated from protobuf field repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setMessageIds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->message_ids = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PubsubMessage.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PubsubMessage.php deleted file mode 100644 index 4c05dc58da3b..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PubsubMessage.php +++ /dev/null @@ -1,280 +0,0 @@ -google.pubsub.v1.PubsubMessage - */ -class PubsubMessage extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. The message data field. If this field is empty, the message must - * contain at least one attribute. - * - * Generated from protobuf field bytes data = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $data = ''; - /** - * Optional. Attributes for this message. If this field is empty, the message - * must contain non-empty data. This can be used to filter messages on the - * subscription. - * - * Generated from protobuf field map attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $attributes; - /** - * ID of this message, assigned by the server when the message is published. - * Guaranteed to be unique within the topic. This value may be read by a - * subscriber that receives a `PubsubMessage` via a `Pull` call or a push - * delivery. It must not be populated by the publisher in a `Publish` call. - * - * Generated from protobuf field string message_id = 3; - */ - protected $message_id = ''; - /** - * The time at which the message was published, populated by the server when - * it receives the `Publish` call. It must not be populated by the - * publisher in a `Publish` call. - * - * Generated from protobuf field .google.protobuf.Timestamp publish_time = 4; - */ - protected $publish_time = null; - /** - * Optional. If non-empty, identifies related messages for which publish order - * should be respected. If a `Subscription` has `enable_message_ordering` set - * to `true`, messages published with the same non-empty `ordering_key` value - * will be delivered to subscribers in the order in which they are received by - * the Pub/Sub system. All `PubsubMessage`s published in a given - * `PublishRequest` must specify the same `ordering_key` value. For more - * information, see [ordering - * messages](https://cloud.google.com/pubsub/docs/ordering). - * - * Generated from protobuf field string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $ordering_key = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $data - * Optional. The message data field. If this field is empty, the message must - * contain at least one attribute. - * @type array|\Google\Protobuf\Internal\MapField $attributes - * Optional. Attributes for this message. If this field is empty, the message - * must contain non-empty data. This can be used to filter messages on the - * subscription. - * @type string $message_id - * ID of this message, assigned by the server when the message is published. - * Guaranteed to be unique within the topic. This value may be read by a - * subscriber that receives a `PubsubMessage` via a `Pull` call or a push - * delivery. It must not be populated by the publisher in a `Publish` call. - * @type \Google\Protobuf\Timestamp $publish_time - * The time at which the message was published, populated by the server when - * it receives the `Publish` call. It must not be populated by the - * publisher in a `Publish` call. - * @type string $ordering_key - * Optional. If non-empty, identifies related messages for which publish order - * should be respected. If a `Subscription` has `enable_message_ordering` set - * to `true`, messages published with the same non-empty `ordering_key` value - * will be delivered to subscribers in the order in which they are received by - * the Pub/Sub system. All `PubsubMessage`s published in a given - * `PublishRequest` must specify the same `ordering_key` value. For more - * information, see [ordering - * messages](https://cloud.google.com/pubsub/docs/ordering). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. The message data field. If this field is empty, the message must - * contain at least one attribute. - * - * Generated from protobuf field bytes data = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getData() - { - return $this->data; - } - - /** - * Optional. The message data field. If this field is empty, the message must - * contain at least one attribute. - * - * Generated from protobuf field bytes data = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setData($var) - { - GPBUtil::checkString($var, False); - $this->data = $var; - - return $this; - } - - /** - * Optional. Attributes for this message. If this field is empty, the message - * must contain non-empty data. This can be used to filter messages on the - * subscription. - * - * Generated from protobuf field map attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getAttributes() - { - return $this->attributes; - } - - /** - * Optional. Attributes for this message. If this field is empty, the message - * must contain non-empty data. This can be used to filter messages on the - * subscription. - * - * Generated from protobuf field map attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setAttributes($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->attributes = $arr; - - return $this; - } - - /** - * ID of this message, assigned by the server when the message is published. - * Guaranteed to be unique within the topic. This value may be read by a - * subscriber that receives a `PubsubMessage` via a `Pull` call or a push - * delivery. It must not be populated by the publisher in a `Publish` call. - * - * Generated from protobuf field string message_id = 3; - * @return string - */ - public function getMessageId() - { - return $this->message_id; - } - - /** - * ID of this message, assigned by the server when the message is published. - * Guaranteed to be unique within the topic. This value may be read by a - * subscriber that receives a `PubsubMessage` via a `Pull` call or a push - * delivery. It must not be populated by the publisher in a `Publish` call. - * - * Generated from protobuf field string message_id = 3; - * @param string $var - * @return $this - */ - public function setMessageId($var) - { - GPBUtil::checkString($var, True); - $this->message_id = $var; - - return $this; - } - - /** - * The time at which the message was published, populated by the server when - * it receives the `Publish` call. It must not be populated by the - * publisher in a `Publish` call. - * - * Generated from protobuf field .google.protobuf.Timestamp publish_time = 4; - * @return \Google\Protobuf\Timestamp|null - */ - public function getPublishTime() - { - return $this->publish_time; - } - - public function hasPublishTime() - { - return isset($this->publish_time); - } - - public function clearPublishTime() - { - unset($this->publish_time); - } - - /** - * The time at which the message was published, populated by the server when - * it receives the `Publish` call. It must not be populated by the - * publisher in a `Publish` call. - * - * Generated from protobuf field .google.protobuf.Timestamp publish_time = 4; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setPublishTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->publish_time = $var; - - return $this; - } - - /** - * Optional. If non-empty, identifies related messages for which publish order - * should be respected. If a `Subscription` has `enable_message_ordering` set - * to `true`, messages published with the same non-empty `ordering_key` value - * will be delivered to subscribers in the order in which they are received by - * the Pub/Sub system. All `PubsubMessage`s published in a given - * `PublishRequest` must specify the same `ordering_key` value. For more - * information, see [ordering - * messages](https://cloud.google.com/pubsub/docs/ordering). - * - * Generated from protobuf field string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getOrderingKey() - { - return $this->ordering_key; - } - - /** - * Optional. If non-empty, identifies related messages for which publish order - * should be respected. If a `Subscription` has `enable_message_ordering` set - * to `true`, messages published with the same non-empty `ordering_key` value - * will be delivered to subscribers in the order in which they are received by - * the Pub/Sub system. All `PubsubMessage`s published in a given - * `PublishRequest` must specify the same `ordering_key` value. For more - * information, see [ordering - * messages](https://cloud.google.com/pubsub/docs/ordering). - * - * Generated from protobuf field string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setOrderingKey($var) - { - GPBUtil::checkString($var, True); - $this->ordering_key = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullRequest.php deleted file mode 100644 index 5d0f8c33aebb..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullRequest.php +++ /dev/null @@ -1,222 +0,0 @@ -google.pubsub.v1.PullRequest - */ -class PullRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The subscription from which messages should be pulled. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $subscription = ''; - /** - * Optional. If this field set to true, the system will respond immediately - * even if it there are no messages available to return in the `Pull` - * response. Otherwise, the system may wait (for a bounded amount of time) - * until at least one message is available, rather than returning no messages. - * Warning: setting this field to `true` is discouraged because it adversely - * impacts the performance of `Pull` operations. We recommend that users do - * not set this field. - * - * Generated from protobuf field bool return_immediately = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; - * @deprecated - */ - protected $return_immediately = false; - /** - * Required. The maximum number of messages to return for this request. Must - * be a positive integer. The Pub/Sub system may return fewer than the number - * specified. - * - * Generated from protobuf field int32 max_messages = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $max_messages = 0; - - /** - * @param string $subscription Required. The subscription from which messages should be pulled. - * Format is `projects/{project}/subscriptions/{sub}`. Please see - * {@see SubscriberClient::subscriptionName()} for help formatting this field. - * @param bool $returnImmediately Optional. If this field set to true, the system will respond immediately - * even if it there are no messages available to return in the `Pull` - * response. Otherwise, the system may wait (for a bounded amount of time) - * until at least one message is available, rather than returning no messages. - * Warning: setting this field to `true` is discouraged because it adversely - * impacts the performance of `Pull` operations. We recommend that users do - * not set this field. - * @param int $maxMessages Required. The maximum number of messages to return for this request. Must - * be a positive integer. The Pub/Sub system may return fewer than the number - * specified. - * - * @return \Google\Cloud\PubSub\V1\PullRequest - * - * @experimental - */ - public static function build(string $subscription, bool $returnImmediately, int $maxMessages): self - { - return (new self()) - ->setSubscription($subscription) - ->setReturnImmediately($returnImmediately) - ->setMaxMessages($maxMessages); - } - - /** - * @param string $subscription Required. The subscription from which messages should be pulled. - * Format is `projects/{project}/subscriptions/{sub}`. Please see - * {@see SubscriberClient::subscriptionName()} for help formatting this field. - * @param int $maxMessages Required. The maximum number of messages to return for this request. Must - * be a positive integer. The Pub/Sub system may return fewer than the number - * specified. - * - * @return \Google\Cloud\PubSub\V1\PullRequest - * - * @experimental - */ - public static function buildFromSubscriptionMaxMessages(string $subscription, int $maxMessages): self - { - return (new self()) - ->setSubscription($subscription) - ->setMaxMessages($maxMessages); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $subscription - * Required. The subscription from which messages should be pulled. - * Format is `projects/{project}/subscriptions/{sub}`. - * @type bool $return_immediately - * Optional. If this field set to true, the system will respond immediately - * even if it there are no messages available to return in the `Pull` - * response. Otherwise, the system may wait (for a bounded amount of time) - * until at least one message is available, rather than returning no messages. - * Warning: setting this field to `true` is discouraged because it adversely - * impacts the performance of `Pull` operations. We recommend that users do - * not set this field. - * @type int $max_messages - * Required. The maximum number of messages to return for this request. Must - * be a positive integer. The Pub/Sub system may return fewer than the number - * specified. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The subscription from which messages should be pulled. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Required. The subscription from which messages should be pulled. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSubscription($var) - { - GPBUtil::checkString($var, True); - $this->subscription = $var; - - return $this; - } - - /** - * Optional. If this field set to true, the system will respond immediately - * even if it there are no messages available to return in the `Pull` - * response. Otherwise, the system may wait (for a bounded amount of time) - * until at least one message is available, rather than returning no messages. - * Warning: setting this field to `true` is discouraged because it adversely - * impacts the performance of `Pull` operations. We recommend that users do - * not set this field. - * - * Generated from protobuf field bool return_immediately = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; - * @return bool - * @deprecated - */ - public function getReturnImmediately() - { - @trigger_error('return_immediately is deprecated.', E_USER_DEPRECATED); - return $this->return_immediately; - } - - /** - * Optional. If this field set to true, the system will respond immediately - * even if it there are no messages available to return in the `Pull` - * response. Otherwise, the system may wait (for a bounded amount of time) - * until at least one message is available, rather than returning no messages. - * Warning: setting this field to `true` is discouraged because it adversely - * impacts the performance of `Pull` operations. We recommend that users do - * not set this field. - * - * Generated from protobuf field bool return_immediately = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - * @deprecated - */ - public function setReturnImmediately($var) - { - @trigger_error('return_immediately is deprecated.', E_USER_DEPRECATED); - GPBUtil::checkBool($var); - $this->return_immediately = $var; - - return $this; - } - - /** - * Required. The maximum number of messages to return for this request. Must - * be a positive integer. The Pub/Sub system may return fewer than the number - * specified. - * - * Generated from protobuf field int32 max_messages = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return int - */ - public function getMaxMessages() - { - return $this->max_messages; - } - - /** - * Required. The maximum number of messages to return for this request. Must - * be a positive integer. The Pub/Sub system may return fewer than the number - * specified. - * - * Generated from protobuf field int32 max_messages = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param int $var - * @return $this - */ - public function setMaxMessages($var) - { - GPBUtil::checkInt32($var); - $this->max_messages = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullResponse.php deleted file mode 100644 index 44c90cd8571c..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PullResponse.php +++ /dev/null @@ -1,83 +0,0 @@ -google.pubsub.v1.PullResponse - */ -class PullResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. Received Pub/Sub messages. The list will be empty if there are no - * more messages available in the backlog, or if no messages could be returned - * before the request timeout. For JSON, the response can be entirely - * empty. The Pub/Sub system may return fewer than the `maxMessages` requested - * even if there are more messages available in the backlog. - * - * Generated from protobuf field repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $received_messages; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\PubSub\V1\ReceivedMessage>|\Google\Protobuf\Internal\RepeatedField $received_messages - * Optional. Received Pub/Sub messages. The list will be empty if there are no - * more messages available in the backlog, or if no messages could be returned - * before the request timeout. For JSON, the response can be entirely - * empty. The Pub/Sub system may return fewer than the `maxMessages` requested - * even if there are more messages available in the backlog. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. Received Pub/Sub messages. The list will be empty if there are no - * more messages available in the backlog, or if no messages could be returned - * before the request timeout. For JSON, the response can be entirely - * empty. The Pub/Sub system may return fewer than the `maxMessages` requested - * even if there are more messages available in the backlog. - * - * Generated from protobuf field repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getReceivedMessages() - { - return $this->received_messages; - } - - /** - * Optional. Received Pub/Sub messages. The list will be empty if there are no - * more messages available in the backlog, or if no messages could be returned - * before the request timeout. For JSON, the response can be entirely - * empty. The Pub/Sub system may return fewer than the `maxMessages` requested - * even if there are more messages available in the backlog. - * - * Generated from protobuf field repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param array<\Google\Cloud\PubSub\V1\ReceivedMessage>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setReceivedMessages($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\ReceivedMessage::class); - $this->received_messages = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig.php deleted file mode 100644 index c0dd0f9777d7..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig.php +++ /dev/null @@ -1,294 +0,0 @@ -google.pubsub.v1.PushConfig - */ -class PushConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. A URL locating the endpoint to which messages should be pushed. - * For example, a Webhook endpoint might use `https://example.com/push`. - * - * Generated from protobuf field string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $push_endpoint = ''; - /** - * Optional. Endpoint configuration attributes that can be used to control - * different aspects of the message delivery. - * The only currently supported attribute is `x-goog-version`, which you can - * use to change the format of the pushed message. This attribute - * indicates the version of the data expected by the endpoint. This - * controls the shape of the pushed message (i.e., its fields and metadata). - * If not present during the `CreateSubscription` call, it will default to - * the version of the Pub/Sub API used to make such call. If not present in a - * `ModifyPushConfig` call, its value will not be changed. `GetSubscription` - * calls will always return a valid version, even if the subscription was - * created without this attribute. - * The only supported values for the `x-goog-version` attribute are: - * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. - * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. - * For example: - * `attributes { "x-goog-version": "v1" }` - * - * Generated from protobuf field map attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $attributes; - protected $authentication_method; - protected $wrapper; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $push_endpoint - * Optional. A URL locating the endpoint to which messages should be pushed. - * For example, a Webhook endpoint might use `https://example.com/push`. - * @type array|\Google\Protobuf\Internal\MapField $attributes - * Optional. Endpoint configuration attributes that can be used to control - * different aspects of the message delivery. - * The only currently supported attribute is `x-goog-version`, which you can - * use to change the format of the pushed message. This attribute - * indicates the version of the data expected by the endpoint. This - * controls the shape of the pushed message (i.e., its fields and metadata). - * If not present during the `CreateSubscription` call, it will default to - * the version of the Pub/Sub API used to make such call. If not present in a - * `ModifyPushConfig` call, its value will not be changed. `GetSubscription` - * calls will always return a valid version, even if the subscription was - * created without this attribute. - * The only supported values for the `x-goog-version` attribute are: - * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. - * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. - * For example: - * `attributes { "x-goog-version": "v1" }` - * @type \Google\Cloud\PubSub\V1\PushConfig\OidcToken $oidc_token - * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT - * token as an `Authorization` header in the HTTP request for every pushed - * message. - * @type \Google\Cloud\PubSub\V1\PushConfig\PubsubWrapper $pubsub_wrapper - * Optional. When set, the payload to the push endpoint is in the form of - * the JSON representation of a PubsubMessage - * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage). - * @type \Google\Cloud\PubSub\V1\PushConfig\NoWrapper $no_wrapper - * Optional. When set, the payload to the push endpoint is not wrapped. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. A URL locating the endpoint to which messages should be pushed. - * For example, a Webhook endpoint might use `https://example.com/push`. - * - * Generated from protobuf field string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getPushEndpoint() - { - return $this->push_endpoint; - } - - /** - * Optional. A URL locating the endpoint to which messages should be pushed. - * For example, a Webhook endpoint might use `https://example.com/push`. - * - * Generated from protobuf field string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setPushEndpoint($var) - { - GPBUtil::checkString($var, True); - $this->push_endpoint = $var; - - return $this; - } - - /** - * Optional. Endpoint configuration attributes that can be used to control - * different aspects of the message delivery. - * The only currently supported attribute is `x-goog-version`, which you can - * use to change the format of the pushed message. This attribute - * indicates the version of the data expected by the endpoint. This - * controls the shape of the pushed message (i.e., its fields and metadata). - * If not present during the `CreateSubscription` call, it will default to - * the version of the Pub/Sub API used to make such call. If not present in a - * `ModifyPushConfig` call, its value will not be changed. `GetSubscription` - * calls will always return a valid version, even if the subscription was - * created without this attribute. - * The only supported values for the `x-goog-version` attribute are: - * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. - * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. - * For example: - * `attributes { "x-goog-version": "v1" }` - * - * Generated from protobuf field map attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getAttributes() - { - return $this->attributes; - } - - /** - * Optional. Endpoint configuration attributes that can be used to control - * different aspects of the message delivery. - * The only currently supported attribute is `x-goog-version`, which you can - * use to change the format of the pushed message. This attribute - * indicates the version of the data expected by the endpoint. This - * controls the shape of the pushed message (i.e., its fields and metadata). - * If not present during the `CreateSubscription` call, it will default to - * the version of the Pub/Sub API used to make such call. If not present in a - * `ModifyPushConfig` call, its value will not be changed. `GetSubscription` - * calls will always return a valid version, even if the subscription was - * created without this attribute. - * The only supported values for the `x-goog-version` attribute are: - * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. - * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. - * For example: - * `attributes { "x-goog-version": "v1" }` - * - * Generated from protobuf field map attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setAttributes($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->attributes = $arr; - - return $this; - } - - /** - * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT - * token as an `Authorization` header in the HTTP request for every pushed - * message. - * - * Generated from protobuf field .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\PushConfig\OidcToken|null - */ - public function getOidcToken() - { - return $this->readOneof(3); - } - - public function hasOidcToken() - { - return $this->hasOneof(3); - } - - /** - * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT - * token as an `Authorization` header in the HTTP request for every pushed - * message. - * - * Generated from protobuf field .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\PushConfig\OidcToken $var - * @return $this - */ - public function setOidcToken($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PushConfig\OidcToken::class); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Optional. When set, the payload to the push endpoint is in the form of - * the JSON representation of a PubsubMessage - * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage). - * - * Generated from protobuf field .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\PushConfig\PubsubWrapper|null - */ - public function getPubsubWrapper() - { - return $this->readOneof(4); - } - - public function hasPubsubWrapper() - { - return $this->hasOneof(4); - } - - /** - * Optional. When set, the payload to the push endpoint is in the form of - * the JSON representation of a PubsubMessage - * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage). - * - * Generated from protobuf field .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\PushConfig\PubsubWrapper $var - * @return $this - */ - public function setPubsubWrapper($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PushConfig\PubsubWrapper::class); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * Optional. When set, the payload to the push endpoint is not wrapped. - * - * Generated from protobuf field .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\PushConfig\NoWrapper|null - */ - public function getNoWrapper() - { - return $this->readOneof(5); - } - - public function hasNoWrapper() - { - return $this->hasOneof(5); - } - - /** - * Optional. When set, the payload to the push endpoint is not wrapped. - * - * Generated from protobuf field .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\PushConfig\NoWrapper $var - * @return $this - */ - public function setNoWrapper($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PushConfig\NoWrapper::class); - $this->writeOneof(5, $var); - - return $this; - } - - /** - * @return string - */ - public function getAuthenticationMethod() - { - return $this->whichOneof("authentication_method"); - } - - /** - * @return string - */ - public function getWrapper() - { - return $this->whichOneof("wrapper"); - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/NoWrapper.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/NoWrapper.php deleted file mode 100644 index ccb4573e0a1c..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/NoWrapper.php +++ /dev/null @@ -1,78 +0,0 @@ -google.pubsub.v1.PushConfig.NoWrapper - */ -class NoWrapper extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. When true, writes the Pub/Sub message metadata to - * `x-goog-pubsub-:` headers of the HTTP request. Writes the - * Pub/Sub message attributes to `:` headers of the HTTP request. - * - * Generated from protobuf field bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $write_metadata = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type bool $write_metadata - * Optional. When true, writes the Pub/Sub message metadata to - * `x-goog-pubsub-:` headers of the HTTP request. Writes the - * Pub/Sub message attributes to `:` headers of the HTTP request. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. When true, writes the Pub/Sub message metadata to - * `x-goog-pubsub-:` headers of the HTTP request. Writes the - * Pub/Sub message attributes to `:` headers of the HTTP request. - * - * Generated from protobuf field bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getWriteMetadata() - { - return $this->write_metadata; - } - - /** - * Optional. When true, writes the Pub/Sub message metadata to - * `x-goog-pubsub-:` headers of the HTTP request. Writes the - * Pub/Sub message attributes to `:` headers of the HTTP request. - * - * Generated from protobuf field bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setWriteMetadata($var) - { - GPBUtil::checkBool($var); - $this->write_metadata = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(NoWrapper::class, \Google\Cloud\PubSub\V1\PushConfig_NoWrapper::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/OidcToken.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/OidcToken.php deleted file mode 100644 index b9558bb3a7d4..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/OidcToken.php +++ /dev/null @@ -1,146 +0,0 @@ -google.pubsub.v1.PushConfig.OidcToken - */ -class OidcToken extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. [Service account - * email](https://cloud.google.com/iam/docs/service-accounts) - * used for generating the OIDC token. For more information - * on setting up authentication, see - * [Push subscriptions](https://cloud.google.com/pubsub/docs/push). - * - * Generated from protobuf field string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $service_account_email = ''; - /** - * Optional. Audience to be used when generating OIDC token. The audience - * claim identifies the recipients that the JWT is intended for. The - * audience value is a single case-sensitive string. Having multiple values - * (array) for the audience field is not supported. More info about the OIDC - * JWT token audience here: - * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, - * the Push endpoint URL will be used. - * - * Generated from protobuf field string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $audience = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $service_account_email - * Optional. [Service account - * email](https://cloud.google.com/iam/docs/service-accounts) - * used for generating the OIDC token. For more information - * on setting up authentication, see - * [Push subscriptions](https://cloud.google.com/pubsub/docs/push). - * @type string $audience - * Optional. Audience to be used when generating OIDC token. The audience - * claim identifies the recipients that the JWT is intended for. The - * audience value is a single case-sensitive string. Having multiple values - * (array) for the audience field is not supported. More info about the OIDC - * JWT token audience here: - * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, - * the Push endpoint URL will be used. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. [Service account - * email](https://cloud.google.com/iam/docs/service-accounts) - * used for generating the OIDC token. For more information - * on setting up authentication, see - * [Push subscriptions](https://cloud.google.com/pubsub/docs/push). - * - * Generated from protobuf field string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getServiceAccountEmail() - { - return $this->service_account_email; - } - - /** - * Optional. [Service account - * email](https://cloud.google.com/iam/docs/service-accounts) - * used for generating the OIDC token. For more information - * on setting up authentication, see - * [Push subscriptions](https://cloud.google.com/pubsub/docs/push). - * - * Generated from protobuf field string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setServiceAccountEmail($var) - { - GPBUtil::checkString($var, True); - $this->service_account_email = $var; - - return $this; - } - - /** - * Optional. Audience to be used when generating OIDC token. The audience - * claim identifies the recipients that the JWT is intended for. The - * audience value is a single case-sensitive string. Having multiple values - * (array) for the audience field is not supported. More info about the OIDC - * JWT token audience here: - * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, - * the Push endpoint URL will be used. - * - * Generated from protobuf field string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getAudience() - { - return $this->audience; - } - - /** - * Optional. Audience to be used when generating OIDC token. The audience - * claim identifies the recipients that the JWT is intended for. The - * audience value is a single case-sensitive string. Having multiple values - * (array) for the audience field is not supported. More info about the OIDC - * JWT token audience here: - * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, - * the Push endpoint URL will be used. - * - * Generated from protobuf field string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setAudience($var) - { - GPBUtil::checkString($var, True); - $this->audience = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(OidcToken::class, \Google\Cloud\PubSub\V1\PushConfig_OidcToken::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/PubsubWrapper.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/PubsubWrapper.php deleted file mode 100644 index 5053bfb85784..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/PushConfig/PubsubWrapper.php +++ /dev/null @@ -1,38 +0,0 @@ -google.pubsub.v1.PushConfig.PubsubWrapper - */ -class PubsubWrapper extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(PubsubWrapper::class, \Google\Cloud\PubSub\V1\PushConfig_PubsubWrapper::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ReceivedMessage.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ReceivedMessage.php deleted file mode 100644 index 3531a302af63..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ReceivedMessage.php +++ /dev/null @@ -1,189 +0,0 @@ -google.pubsub.v1.ReceivedMessage - */ -class ReceivedMessage extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. This ID can be used to acknowledge the received message. - * - * Generated from protobuf field string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $ack_id = ''; - /** - * Optional. The message. - * - * Generated from protobuf field .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $message = null; - /** - * Optional. The approximate number of times that Pub/Sub has attempted to - * deliver the associated message to a subscriber. - * More precisely, this is 1 + (number of NACKs) + - * (number of ack_deadline exceeds) for this message. - * A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline - * exceeds event is whenever a message is not acknowledged within - * ack_deadline. Note that ack_deadline is initially - * Subscription.ackDeadlineSeconds, but may get extended automatically by - * the client library. - * Upon the first delivery of a given message, `delivery_attempt` will have a - * value of 1. The value is calculated at best effort and is approximate. - * If a DeadLetterPolicy is not set on the subscription, this will be 0. - * - * Generated from protobuf field int32 delivery_attempt = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $delivery_attempt = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $ack_id - * Optional. This ID can be used to acknowledge the received message. - * @type \Google\Cloud\PubSub\V1\PubsubMessage $message - * Optional. The message. - * @type int $delivery_attempt - * Optional. The approximate number of times that Pub/Sub has attempted to - * deliver the associated message to a subscriber. - * More precisely, this is 1 + (number of NACKs) + - * (number of ack_deadline exceeds) for this message. - * A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline - * exceeds event is whenever a message is not acknowledged within - * ack_deadline. Note that ack_deadline is initially - * Subscription.ackDeadlineSeconds, but may get extended automatically by - * the client library. - * Upon the first delivery of a given message, `delivery_attempt` will have a - * value of 1. The value is calculated at best effort and is approximate. - * If a DeadLetterPolicy is not set on the subscription, this will be 0. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. This ID can be used to acknowledge the received message. - * - * Generated from protobuf field string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getAckId() - { - return $this->ack_id; - } - - /** - * Optional. This ID can be used to acknowledge the received message. - * - * Generated from protobuf field string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setAckId($var) - { - GPBUtil::checkString($var, True); - $this->ack_id = $var; - - return $this; - } - - /** - * Optional. The message. - * - * Generated from protobuf field .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\PubsubMessage|null - */ - public function getMessage() - { - return $this->message; - } - - public function hasMessage() - { - return isset($this->message); - } - - public function clearMessage() - { - unset($this->message); - } - - /** - * Optional. The message. - * - * Generated from protobuf field .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\PubsubMessage $var - * @return $this - */ - public function setMessage($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PubsubMessage::class); - $this->message = $var; - - return $this; - } - - /** - * Optional. The approximate number of times that Pub/Sub has attempted to - * deliver the associated message to a subscriber. - * More precisely, this is 1 + (number of NACKs) + - * (number of ack_deadline exceeds) for this message. - * A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline - * exceeds event is whenever a message is not acknowledged within - * ack_deadline. Note that ack_deadline is initially - * Subscription.ackDeadlineSeconds, but may get extended automatically by - * the client library. - * Upon the first delivery of a given message, `delivery_attempt` will have a - * value of 1. The value is calculated at best effort and is approximate. - * If a DeadLetterPolicy is not set on the subscription, this will be 0. - * - * Generated from protobuf field int32 delivery_attempt = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getDeliveryAttempt() - { - return $this->delivery_attempt; - } - - /** - * Optional. The approximate number of times that Pub/Sub has attempted to - * deliver the associated message to a subscriber. - * More precisely, this is 1 + (number of NACKs) + - * (number of ack_deadline exceeds) for this message. - * A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline - * exceeds event is whenever a message is not acknowledged within - * ack_deadline. Note that ack_deadline is initially - * Subscription.ackDeadlineSeconds, but may get extended automatically by - * the client library. - * Upon the first delivery of a given message, `delivery_attempt` will have a - * value of 1. The value is calculated at best effort and is approximate. - * If a DeadLetterPolicy is not set on the subscription, this will be 0. - * - * Generated from protobuf field int32 delivery_attempt = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setDeliveryAttempt($var) - { - GPBUtil::checkInt32($var); - $this->delivery_attempt = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RetryPolicy.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RetryPolicy.php deleted file mode 100644 index db6cf2e3d739..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RetryPolicy.php +++ /dev/null @@ -1,140 +0,0 @@ -google.pubsub.v1.RetryPolicy - */ -class RetryPolicy extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. The minimum delay between consecutive deliveries of a given - * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. - * - * Generated from protobuf field .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $minimum_backoff = null; - /** - * Optional. The maximum delay between consecutive deliveries of a given - * message. Value should be between 0 and 600 seconds. Defaults to 600 - * seconds. - * - * Generated from protobuf field .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $maximum_backoff = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Protobuf\Duration $minimum_backoff - * Optional. The minimum delay between consecutive deliveries of a given - * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. - * @type \Google\Protobuf\Duration $maximum_backoff - * Optional. The maximum delay between consecutive deliveries of a given - * message. Value should be between 0 and 600 seconds. Defaults to 600 - * seconds. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. The minimum delay between consecutive deliveries of a given - * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. - * - * Generated from protobuf field .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Duration|null - */ - public function getMinimumBackoff() - { - return $this->minimum_backoff; - } - - public function hasMinimumBackoff() - { - return isset($this->minimum_backoff); - } - - public function clearMinimumBackoff() - { - unset($this->minimum_backoff); - } - - /** - * Optional. The minimum delay between consecutive deliveries of a given - * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. - * - * Generated from protobuf field .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setMinimumBackoff($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->minimum_backoff = $var; - - return $this; - } - - /** - * Optional. The maximum delay between consecutive deliveries of a given - * message. Value should be between 0 and 600 seconds. Defaults to 600 - * seconds. - * - * Generated from protobuf field .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Duration|null - */ - public function getMaximumBackoff() - { - return $this->maximum_backoff; - } - - public function hasMaximumBackoff() - { - return isset($this->maximum_backoff); - } - - public function clearMaximumBackoff() - { - unset($this->maximum_backoff); - } - - /** - * Optional. The maximum delay between consecutive deliveries of a given - * message. Value should be between 0 and 600 seconds. Defaults to 600 - * seconds. - * - * Generated from protobuf field .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setMaximumBackoff($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->maximum_backoff = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RollbackSchemaRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RollbackSchemaRequest.php deleted file mode 100644 index 2bf316de83de..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/RollbackSchemaRequest.php +++ /dev/null @@ -1,128 +0,0 @@ -google.pubsub.v1.RollbackSchemaRequest - */ -class RollbackSchemaRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The schema being rolled back with revision id. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * Required. The revision ID to roll back to. - * It must be a revision of the same schema. - * Example: c7cfa2a8 - * - * Generated from protobuf field string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $revision_id = ''; - - /** - * @param string $name Required. The schema being rolled back with revision id. Please see - * {@see SchemaServiceClient::schemaName()} for help formatting this field. - * @param string $revisionId Required. The revision ID to roll back to. - * It must be a revision of the same schema. - * - * Example: c7cfa2a8 - * - * @return \Google\Cloud\PubSub\V1\RollbackSchemaRequest - * - * @experimental - */ - public static function build(string $name, string $revisionId): self - { - return (new self()) - ->setName($name) - ->setRevisionId($revisionId); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The schema being rolled back with revision id. - * @type string $revision_id - * Required. The revision ID to roll back to. - * It must be a revision of the same schema. - * Example: c7cfa2a8 - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - - /** - * Required. The schema being rolled back with revision id. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The schema being rolled back with revision id. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Required. The revision ID to roll back to. - * It must be a revision of the same schema. - * Example: c7cfa2a8 - * - * Generated from protobuf field string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getRevisionId() - { - return $this->revision_id; - } - - /** - * Required. The revision ID to roll back to. - * It must be a revision of the same schema. - * Example: c7cfa2a8 - * - * Generated from protobuf field string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setRevisionId($var) - { - GPBUtil::checkString($var, True); - $this->revision_id = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema.php deleted file mode 100644 index 9521db88c5ad..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema.php +++ /dev/null @@ -1,225 +0,0 @@ -google.pubsub.v1.Schema - */ -class Schema extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Name of the schema. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - /** - * The type of the schema definition. - * - * Generated from protobuf field .google.pubsub.v1.Schema.Type type = 2; - */ - protected $type = 0; - /** - * The definition of the schema. This should contain a string representing - * the full definition of the schema that is a valid schema definition of - * the type specified in `type`. - * - * Generated from protobuf field string definition = 3; - */ - protected $definition = ''; - /** - * Output only. Immutable. The revision ID of the schema. - * - * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $revision_id = ''; - /** - * Output only. The timestamp that the revision was created. - * - * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $revision_create_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Name of the schema. - * Format is `projects/{project}/schemas/{schema}`. - * @type int $type - * The type of the schema definition. - * @type string $definition - * The definition of the schema. This should contain a string representing - * the full definition of the schema that is a valid schema definition of - * the type specified in `type`. - * @type string $revision_id - * Output only. Immutable. The revision ID of the schema. - * @type \Google\Protobuf\Timestamp $revision_create_time - * Output only. The timestamp that the revision was created. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - - /** - * Required. Name of the schema. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Name of the schema. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The type of the schema definition. - * - * Generated from protobuf field .google.pubsub.v1.Schema.Type type = 2; - * @return int - */ - public function getType() - { - return $this->type; - } - - /** - * The type of the schema definition. - * - * Generated from protobuf field .google.pubsub.v1.Schema.Type type = 2; - * @param int $var - * @return $this - */ - public function setType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\Schema\Type::class); - $this->type = $var; - - return $this; - } - - /** - * The definition of the schema. This should contain a string representing - * the full definition of the schema that is a valid schema definition of - * the type specified in `type`. - * - * Generated from protobuf field string definition = 3; - * @return string - */ - public function getDefinition() - { - return $this->definition; - } - - /** - * The definition of the schema. This should contain a string representing - * the full definition of the schema that is a valid schema definition of - * the type specified in `type`. - * - * Generated from protobuf field string definition = 3; - * @param string $var - * @return $this - */ - public function setDefinition($var) - { - GPBUtil::checkString($var, True); - $this->definition = $var; - - return $this; - } - - /** - * Output only. Immutable. The revision ID of the schema. - * - * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getRevisionId() - { - return $this->revision_id; - } - - /** - * Output only. Immutable. The revision ID of the schema. - * - * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setRevisionId($var) - { - GPBUtil::checkString($var, True); - $this->revision_id = $var; - - return $this; - } - - /** - * Output only. The timestamp that the revision was created. - * - * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getRevisionCreateTime() - { - return $this->revision_create_time; - } - - public function hasRevisionCreateTime() - { - return isset($this->revision_create_time); - } - - public function clearRevisionCreateTime() - { - unset($this->revision_create_time); - } - - /** - * Output only. The timestamp that the revision was created. - * - * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setRevisionCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->revision_create_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema/Type.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema/Type.php deleted file mode 100644 index 31945e1e640b..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Schema/Type.php +++ /dev/null @@ -1,64 +0,0 @@ -google.pubsub.v1.Schema.Type - */ -class Type -{ - /** - * Default value. This value is unused. - * - * Generated from protobuf enum TYPE_UNSPECIFIED = 0; - */ - const TYPE_UNSPECIFIED = 0; - /** - * A Protocol Buffer schema definition. - * - * Generated from protobuf enum PROTOCOL_BUFFER = 1; - */ - const PROTOCOL_BUFFER = 1; - /** - * An Avro schema definition. - * - * Generated from protobuf enum AVRO = 2; - */ - const AVRO = 2; - - private static $valueToName = [ - self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', - self::PROTOCOL_BUFFER => 'PROTOCOL_BUFFER', - self::AVRO => 'AVRO', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Type::class, \Google\Cloud\PubSub\V1\Schema_Type::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaSettings.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaSettings.php deleted file mode 100644 index f32a917284c2..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaSettings.php +++ /dev/null @@ -1,197 +0,0 @@ -google.pubsub.v1.SchemaSettings - */ -class SchemaSettings extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the schema that messages published should be - * validated against. Format is `projects/{project}/schemas/{schema}`. The - * value of this field will be `_deleted-schema_` if the schema has been - * deleted. - * - * Generated from protobuf field string schema = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $schema = ''; - /** - * Optional. The encoding of messages validated against `schema`. - * - * Generated from protobuf field .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $encoding = 0; - /** - * Optional. The minimum (inclusive) revision allowed for validating messages. - * If empty or not present, allow any revision to be validated against - * last_revision or any revision created before. - * - * Generated from protobuf field string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $first_revision_id = ''; - /** - * Optional. The maximum (inclusive) revision allowed for validating messages. - * If empty or not present, allow any revision to be validated against - * first_revision or any revision created after. - * - * Generated from protobuf field string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $last_revision_id = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $schema - * Required. The name of the schema that messages published should be - * validated against. Format is `projects/{project}/schemas/{schema}`. The - * value of this field will be `_deleted-schema_` if the schema has been - * deleted. - * @type int $encoding - * Optional. The encoding of messages validated against `schema`. - * @type string $first_revision_id - * Optional. The minimum (inclusive) revision allowed for validating messages. - * If empty or not present, allow any revision to be validated against - * last_revision or any revision created before. - * @type string $last_revision_id - * Optional. The maximum (inclusive) revision allowed for validating messages. - * If empty or not present, allow any revision to be validated against - * first_revision or any revision created after. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the schema that messages published should be - * validated against. Format is `projects/{project}/schemas/{schema}`. The - * value of this field will be `_deleted-schema_` if the schema has been - * deleted. - * - * Generated from protobuf field string schema = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSchema() - { - return $this->schema; - } - - /** - * Required. The name of the schema that messages published should be - * validated against. Format is `projects/{project}/schemas/{schema}`. The - * value of this field will be `_deleted-schema_` if the schema has been - * deleted. - * - * Generated from protobuf field string schema = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSchema($var) - { - GPBUtil::checkString($var, True); - $this->schema = $var; - - return $this; - } - - /** - * Optional. The encoding of messages validated against `schema`. - * - * Generated from protobuf field .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getEncoding() - { - return $this->encoding; - } - - /** - * Optional. The encoding of messages validated against `schema`. - * - * Generated from protobuf field .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setEncoding($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\Encoding::class); - $this->encoding = $var; - - return $this; - } - - /** - * Optional. The minimum (inclusive) revision allowed for validating messages. - * If empty or not present, allow any revision to be validated against - * last_revision or any revision created before. - * - * Generated from protobuf field string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getFirstRevisionId() - { - return $this->first_revision_id; - } - - /** - * Optional. The minimum (inclusive) revision allowed for validating messages. - * If empty or not present, allow any revision to be validated against - * last_revision or any revision created before. - * - * Generated from protobuf field string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setFirstRevisionId($var) - { - GPBUtil::checkString($var, True); - $this->first_revision_id = $var; - - return $this; - } - - /** - * Optional. The maximum (inclusive) revision allowed for validating messages. - * If empty or not present, allow any revision to be validated against - * first_revision or any revision created after. - * - * Generated from protobuf field string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getLastRevisionId() - { - return $this->last_revision_id; - } - - /** - * Optional. The maximum (inclusive) revision allowed for validating messages. - * If empty or not present, allow any revision to be validated against - * first_revision or any revision created after. - * - * Generated from protobuf field string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setLastRevisionId($var) - { - GPBUtil::checkString($var, True); - $this->last_revision_id = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaView.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaView.php deleted file mode 100644 index 5434e27c62b5..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SchemaView.php +++ /dev/null @@ -1,62 +0,0 @@ -google.pubsub.v1.SchemaView - */ -class SchemaView -{ - /** - * The default / unset value. - * The API will default to the BASIC view. - * - * Generated from protobuf enum SCHEMA_VIEW_UNSPECIFIED = 0; - */ - const SCHEMA_VIEW_UNSPECIFIED = 0; - /** - * Include the name and type of the schema, but not the definition. - * - * Generated from protobuf enum BASIC = 1; - */ - const BASIC = 1; - /** - * Include all Schema object fields. - * - * Generated from protobuf enum FULL = 2; - */ - const FULL = 2; - - private static $valueToName = [ - self::SCHEMA_VIEW_UNSPECIFIED => 'SCHEMA_VIEW_UNSPECIFIED', - self::BASIC => 'BASIC', - self::FULL => 'FULL', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekRequest.php deleted file mode 100644 index 0f726f6024ef..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekRequest.php +++ /dev/null @@ -1,178 +0,0 @@ -google.pubsub.v1.SeekRequest - */ -class SeekRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The subscription to affect. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $subscription = ''; - protected $target; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $subscription - * Required. The subscription to affect. - * @type \Google\Protobuf\Timestamp $time - * Optional. The time to seek to. - * Messages retained in the subscription that were published before this - * time are marked as acknowledged, and messages retained in the - * subscription that were published after this time are marked as - * unacknowledged. Note that this operation affects only those messages - * retained in the subscription (configured by the combination of - * `message_retention_duration` and `retain_acked_messages`). For example, - * if `time` corresponds to a point before the message retention - * window (or to a point before the system's notion of the subscription - * creation time), only retained messages will be marked as unacknowledged, - * and already-expunged messages will not be restored. - * @type string $snapshot - * Optional. The snapshot to seek to. The snapshot's topic must be the same - * as that of the provided subscription. Format is - * `projects/{project}/snapshots/{snap}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The subscription to affect. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Required. The subscription to affect. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSubscription($var) - { - GPBUtil::checkString($var, True); - $this->subscription = $var; - - return $this; - } - - /** - * Optional. The time to seek to. - * Messages retained in the subscription that were published before this - * time are marked as acknowledged, and messages retained in the - * subscription that were published after this time are marked as - * unacknowledged. Note that this operation affects only those messages - * retained in the subscription (configured by the combination of - * `message_retention_duration` and `retain_acked_messages`). For example, - * if `time` corresponds to a point before the message retention - * window (or to a point before the system's notion of the subscription - * creation time), only retained messages will be marked as unacknowledged, - * and already-expunged messages will not be restored. - * - * Generated from protobuf field .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getTime() - { - return $this->readOneof(2); - } - - public function hasTime() - { - return $this->hasOneof(2); - } - - /** - * Optional. The time to seek to. - * Messages retained in the subscription that were published before this - * time are marked as acknowledged, and messages retained in the - * subscription that were published after this time are marked as - * unacknowledged. Note that this operation affects only those messages - * retained in the subscription (configured by the combination of - * `message_retention_duration` and `retain_acked_messages`). For example, - * if `time` corresponds to a point before the message retention - * window (or to a point before the system's notion of the subscription - * creation time), only retained messages will be marked as unacknowledged, - * and already-expunged messages will not be restored. - * - * Generated from protobuf field .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * Optional. The snapshot to seek to. The snapshot's topic must be the same - * as that of the provided subscription. Format is - * `projects/{project}/snapshots/{snap}`. - * - * Generated from protobuf field string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @return string - */ - public function getSnapshot() - { - return $this->readOneof(3); - } - - public function hasSnapshot() - { - return $this->hasOneof(3); - } - - /** - * Optional. The snapshot to seek to. The snapshot's topic must be the same - * as that of the provided subscription. Format is - * `projects/{project}/snapshots/{snap}`. - * - * Generated from protobuf field string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSnapshot($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * @return string - */ - public function getTarget() - { - return $this->whichOneof("target"); - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekResponse.php deleted file mode 100644 index cf1f98bba3c0..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/SeekResponse.php +++ /dev/null @@ -1,33 +0,0 @@ -google.pubsub.v1.SeekResponse - */ -class SeekResponse extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Snapshot.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Snapshot.php deleted file mode 100644 index 0861e885aad5..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Snapshot.php +++ /dev/null @@ -1,227 +0,0 @@ -google.pubsub.v1.Snapshot - */ -class Snapshot extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. The name of the snapshot. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $name = ''; - /** - * Optional. The name of the topic from which this snapshot is retaining - * messages. - * - * Generated from protobuf field string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - */ - protected $topic = ''; - /** - * Optional. The snapshot is guaranteed to exist up until this time. - * A newly-created snapshot expires no later than 7 days from the time of its - * creation. Its exact lifetime is determined at creation by the existing - * backlog in the source subscription. Specifically, the lifetime of the - * snapshot is `7 days - (age of oldest unacked message in the subscription)`. - * For example, consider a subscription whose oldest unacked message is 3 days - * old. If a snapshot is created from this subscription, the snapshot -- which - * will always capture this 3-day-old backlog as long as the snapshot - * exists -- will expire in 4 days. The service will refuse to create a - * snapshot that would expire in less than 1 hour after creation. - * - * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $expire_time = null; - /** - * Optional. See [Creating and managing labels] - * (https://cloud.google.com/pubsub/docs/labels). - * - * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $labels; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Optional. The name of the snapshot. - * @type string $topic - * Optional. The name of the topic from which this snapshot is retaining - * messages. - * @type \Google\Protobuf\Timestamp $expire_time - * Optional. The snapshot is guaranteed to exist up until this time. - * A newly-created snapshot expires no later than 7 days from the time of its - * creation. Its exact lifetime is determined at creation by the existing - * backlog in the source subscription. Specifically, the lifetime of the - * snapshot is `7 days - (age of oldest unacked message in the subscription)`. - * For example, consider a subscription whose oldest unacked message is 3 days - * old. If a snapshot is created from this subscription, the snapshot -- which - * will always capture this 3-day-old backlog as long as the snapshot - * exists -- will expire in 4 days. The service will refuse to create a - * snapshot that would expire in less than 1 hour after creation. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Optional. See [Creating and managing labels] - * (https://cloud.google.com/pubsub/docs/labels). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. The name of the snapshot. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Optional. The name of the snapshot. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Optional. The name of the topic from which this snapshot is retaining - * messages. - * - * Generated from protobuf field string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @return string - */ - public function getTopic() - { - return $this->topic; - } - - /** - * Optional. The name of the topic from which this snapshot is retaining - * messages. - * - * Generated from protobuf field string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setTopic($var) - { - GPBUtil::checkString($var, True); - $this->topic = $var; - - return $this; - } - - /** - * Optional. The snapshot is guaranteed to exist up until this time. - * A newly-created snapshot expires no later than 7 days from the time of its - * creation. Its exact lifetime is determined at creation by the existing - * backlog in the source subscription. Specifically, the lifetime of the - * snapshot is `7 days - (age of oldest unacked message in the subscription)`. - * For example, consider a subscription whose oldest unacked message is 3 days - * old. If a snapshot is created from this subscription, the snapshot -- which - * will always capture this 3-day-old backlog as long as the snapshot - * exists -- will expire in 4 days. The service will refuse to create a - * snapshot that would expire in less than 1 hour after creation. - * - * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getExpireTime() - { - return $this->expire_time; - } - - public function hasExpireTime() - { - return isset($this->expire_time); - } - - public function clearExpireTime() - { - unset($this->expire_time); - } - - /** - * Optional. The snapshot is guaranteed to exist up until this time. - * A newly-created snapshot expires no later than 7 days from the time of its - * creation. Its exact lifetime is determined at creation by the existing - * backlog in the source subscription. Specifically, the lifetime of the - * snapshot is `7 days - (age of oldest unacked message in the subscription)`. - * For example, consider a subscription whose oldest unacked message is 3 days - * old. If a snapshot is created from this subscription, the snapshot -- which - * will always capture this 3-day-old backlog as long as the snapshot - * exists -- will expire in 4 days. The service will refuse to create a - * snapshot that would expire in less than 1 hour after creation. - * - * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setExpireTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->expire_time = $var; - - return $this; - } - - /** - * Optional. See [Creating and managing labels] - * (https://cloud.google.com/pubsub/docs/labels). - * - * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Optional. See [Creating and managing labels] - * (https://cloud.google.com/pubsub/docs/labels). - * - * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setLabels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->labels = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullRequest.php deleted file mode 100644 index f51c899b073f..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullRequest.php +++ /dev/null @@ -1,491 +0,0 @@ -google.pubsub.v1.StreamingPullRequest - */ -class StreamingPullRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The subscription for which to initialize the new stream. This - * must be provided in the first request on the stream, and must not be set in - * subsequent requests from client to server. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $subscription = ''; - /** - * Optional. List of acknowledgement IDs for acknowledging previously received - * messages (received on this stream or a different stream). If an ack ID has - * expired, the corresponding message may be redelivered later. Acknowledging - * a message more than once will not result in an error. If the - * acknowledgement ID is malformed, the stream will be aborted with status - * `INVALID_ARGUMENT`. - * - * Generated from protobuf field repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $ack_ids; - /** - * Optional. The list of new ack deadlines for the IDs listed in - * `modify_deadline_ack_ids`. The size of this list must be the same as the - * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted - * with `INVALID_ARGUMENT`. Each element in this list is applied to the - * element in the same position in `modify_deadline_ack_ids`. The new ack - * deadline is with respect to the time this request was sent to the Pub/Sub - * system. Must be >= 0. For example, if the value is 10, the new ack deadline - * will expire 10 seconds after this request is received. If the value is 0, - * the message is immediately made available for another streaming or - * non-streaming pull request. If the value is < 0 (an error), the stream will - * be aborted with status `INVALID_ARGUMENT`. - * - * Generated from protobuf field repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $modify_deadline_seconds; - /** - * Optional. List of acknowledgement IDs whose deadline will be modified based - * on the corresponding element in `modify_deadline_seconds`. This field can - * be used to indicate that more time is needed to process a message by the - * subscriber, or to make the message available for redelivery if the - * processing was interrupted. - * - * Generated from protobuf field repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $modify_deadline_ack_ids; - /** - * Required. The ack deadline to use for the stream. This must be provided in - * the first request on the stream, but it can also be updated on subsequent - * requests from client to server. The minimum deadline you can specify is 10 - * seconds. The maximum deadline you can specify is 600 seconds (10 minutes). - * - * Generated from protobuf field int32 stream_ack_deadline_seconds = 5 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $stream_ack_deadline_seconds = 0; - /** - * Optional. A unique identifier that is used to distinguish client instances - * from each other. Only needs to be provided on the initial request. When a - * stream disconnects and reconnects for the same stream, the client_id should - * be set to the same value so that state associated with the old stream can - * be transferred to the new stream. The same client_id should not be used for - * different client instances. - * - * Generated from protobuf field string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $client_id = ''; - /** - * Optional. Flow control settings for the maximum number of outstanding - * messages. When there are `max_outstanding_messages` currently sent to the - * streaming pull client that have not yet been acked or nacked, the server - * stops sending more messages. The sending of messages resumes once the - * number of outstanding messages is less than this value. If the value is - * <= 0, there is no limit to the number of outstanding messages. This - * property can only be set on the initial StreamingPullRequest. If it is set - * on a subsequent request, the stream will be aborted with status - * `INVALID_ARGUMENT`. - * - * Generated from protobuf field int64 max_outstanding_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $max_outstanding_messages = 0; - /** - * Optional. Flow control settings for the maximum number of outstanding - * bytes. When there are `max_outstanding_bytes` or more worth of messages - * currently sent to the streaming pull client that have not yet been acked or - * nacked, the server will stop sending more messages. The sending of messages - * resumes once the number of outstanding bytes is less than this value. If - * the value is <= 0, there is no limit to the number of outstanding bytes. - * This property can only be set on the initial StreamingPullRequest. If it is - * set on a subsequent request, the stream will be aborted with status - * `INVALID_ARGUMENT`. - * - * Generated from protobuf field int64 max_outstanding_bytes = 8 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $max_outstanding_bytes = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $subscription - * Required. The subscription for which to initialize the new stream. This - * must be provided in the first request on the stream, and must not be set in - * subsequent requests from client to server. - * Format is `projects/{project}/subscriptions/{sub}`. - * @type array|\Google\Protobuf\Internal\RepeatedField $ack_ids - * Optional. List of acknowledgement IDs for acknowledging previously received - * messages (received on this stream or a different stream). If an ack ID has - * expired, the corresponding message may be redelivered later. Acknowledging - * a message more than once will not result in an error. If the - * acknowledgement ID is malformed, the stream will be aborted with status - * `INVALID_ARGUMENT`. - * @type array|\Google\Protobuf\Internal\RepeatedField $modify_deadline_seconds - * Optional. The list of new ack deadlines for the IDs listed in - * `modify_deadline_ack_ids`. The size of this list must be the same as the - * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted - * with `INVALID_ARGUMENT`. Each element in this list is applied to the - * element in the same position in `modify_deadline_ack_ids`. The new ack - * deadline is with respect to the time this request was sent to the Pub/Sub - * system. Must be >= 0. For example, if the value is 10, the new ack deadline - * will expire 10 seconds after this request is received. If the value is 0, - * the message is immediately made available for another streaming or - * non-streaming pull request. If the value is < 0 (an error), the stream will - * be aborted with status `INVALID_ARGUMENT`. - * @type array|\Google\Protobuf\Internal\RepeatedField $modify_deadline_ack_ids - * Optional. List of acknowledgement IDs whose deadline will be modified based - * on the corresponding element in `modify_deadline_seconds`. This field can - * be used to indicate that more time is needed to process a message by the - * subscriber, or to make the message available for redelivery if the - * processing was interrupted. - * @type int $stream_ack_deadline_seconds - * Required. The ack deadline to use for the stream. This must be provided in - * the first request on the stream, but it can also be updated on subsequent - * requests from client to server. The minimum deadline you can specify is 10 - * seconds. The maximum deadline you can specify is 600 seconds (10 minutes). - * @type string $client_id - * Optional. A unique identifier that is used to distinguish client instances - * from each other. Only needs to be provided on the initial request. When a - * stream disconnects and reconnects for the same stream, the client_id should - * be set to the same value so that state associated with the old stream can - * be transferred to the new stream. The same client_id should not be used for - * different client instances. - * @type int|string $max_outstanding_messages - * Optional. Flow control settings for the maximum number of outstanding - * messages. When there are `max_outstanding_messages` currently sent to the - * streaming pull client that have not yet been acked or nacked, the server - * stops sending more messages. The sending of messages resumes once the - * number of outstanding messages is less than this value. If the value is - * <= 0, there is no limit to the number of outstanding messages. This - * property can only be set on the initial StreamingPullRequest. If it is set - * on a subsequent request, the stream will be aborted with status - * `INVALID_ARGUMENT`. - * @type int|string $max_outstanding_bytes - * Optional. Flow control settings for the maximum number of outstanding - * bytes. When there are `max_outstanding_bytes` or more worth of messages - * currently sent to the streaming pull client that have not yet been acked or - * nacked, the server will stop sending more messages. The sending of messages - * resumes once the number of outstanding bytes is less than this value. If - * the value is <= 0, there is no limit to the number of outstanding bytes. - * This property can only be set on the initial StreamingPullRequest. If it is - * set on a subsequent request, the stream will be aborted with status - * `INVALID_ARGUMENT`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The subscription for which to initialize the new stream. This - * must be provided in the first request on the stream, and must not be set in - * subsequent requests from client to server. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Required. The subscription for which to initialize the new stream. This - * must be provided in the first request on the stream, and must not be set in - * subsequent requests from client to server. - * Format is `projects/{project}/subscriptions/{sub}`. - * - * Generated from protobuf field string subscription = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSubscription($var) - { - GPBUtil::checkString($var, True); - $this->subscription = $var; - - return $this; - } - - /** - * Optional. List of acknowledgement IDs for acknowledging previously received - * messages (received on this stream or a different stream). If an ack ID has - * expired, the corresponding message may be redelivered later. Acknowledging - * a message more than once will not result in an error. If the - * acknowledgement ID is malformed, the stream will be aborted with status - * `INVALID_ARGUMENT`. - * - * Generated from protobuf field repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getAckIds() - { - return $this->ack_ids; - } - - /** - * Optional. List of acknowledgement IDs for acknowledging previously received - * messages (received on this stream or a different stream). If an ack ID has - * expired, the corresponding message may be redelivered later. Acknowledging - * a message more than once will not result in an error. If the - * acknowledgement ID is malformed, the stream will be aborted with status - * `INVALID_ARGUMENT`. - * - * Generated from protobuf field repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setAckIds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->ack_ids = $arr; - - return $this; - } - - /** - * Optional. The list of new ack deadlines for the IDs listed in - * `modify_deadline_ack_ids`. The size of this list must be the same as the - * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted - * with `INVALID_ARGUMENT`. Each element in this list is applied to the - * element in the same position in `modify_deadline_ack_ids`. The new ack - * deadline is with respect to the time this request was sent to the Pub/Sub - * system. Must be >= 0. For example, if the value is 10, the new ack deadline - * will expire 10 seconds after this request is received. If the value is 0, - * the message is immediately made available for another streaming or - * non-streaming pull request. If the value is < 0 (an error), the stream will - * be aborted with status `INVALID_ARGUMENT`. - * - * Generated from protobuf field repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getModifyDeadlineSeconds() - { - return $this->modify_deadline_seconds; - } - - /** - * Optional. The list of new ack deadlines for the IDs listed in - * `modify_deadline_ack_ids`. The size of this list must be the same as the - * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted - * with `INVALID_ARGUMENT`. Each element in this list is applied to the - * element in the same position in `modify_deadline_ack_ids`. The new ack - * deadline is with respect to the time this request was sent to the Pub/Sub - * system. Must be >= 0. For example, if the value is 10, the new ack deadline - * will expire 10 seconds after this request is received. If the value is 0, - * the message is immediately made available for another streaming or - * non-streaming pull request. If the value is < 0 (an error), the stream will - * be aborted with status `INVALID_ARGUMENT`. - * - * Generated from protobuf field repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setModifyDeadlineSeconds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->modify_deadline_seconds = $arr; - - return $this; - } - - /** - * Optional. List of acknowledgement IDs whose deadline will be modified based - * on the corresponding element in `modify_deadline_seconds`. This field can - * be used to indicate that more time is needed to process a message by the - * subscriber, or to make the message available for redelivery if the - * processing was interrupted. - * - * Generated from protobuf field repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getModifyDeadlineAckIds() - { - return $this->modify_deadline_ack_ids; - } - - /** - * Optional. List of acknowledgement IDs whose deadline will be modified based - * on the corresponding element in `modify_deadline_seconds`. This field can - * be used to indicate that more time is needed to process a message by the - * subscriber, or to make the message available for redelivery if the - * processing was interrupted. - * - * Generated from protobuf field repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setModifyDeadlineAckIds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->modify_deadline_ack_ids = $arr; - - return $this; - } - - /** - * Required. The ack deadline to use for the stream. This must be provided in - * the first request on the stream, but it can also be updated on subsequent - * requests from client to server. The minimum deadline you can specify is 10 - * seconds. The maximum deadline you can specify is 600 seconds (10 minutes). - * - * Generated from protobuf field int32 stream_ack_deadline_seconds = 5 [(.google.api.field_behavior) = REQUIRED]; - * @return int - */ - public function getStreamAckDeadlineSeconds() - { - return $this->stream_ack_deadline_seconds; - } - - /** - * Required. The ack deadline to use for the stream. This must be provided in - * the first request on the stream, but it can also be updated on subsequent - * requests from client to server. The minimum deadline you can specify is 10 - * seconds. The maximum deadline you can specify is 600 seconds (10 minutes). - * - * Generated from protobuf field int32 stream_ack_deadline_seconds = 5 [(.google.api.field_behavior) = REQUIRED]; - * @param int $var - * @return $this - */ - public function setStreamAckDeadlineSeconds($var) - { - GPBUtil::checkInt32($var); - $this->stream_ack_deadline_seconds = $var; - - return $this; - } - - /** - * Optional. A unique identifier that is used to distinguish client instances - * from each other. Only needs to be provided on the initial request. When a - * stream disconnects and reconnects for the same stream, the client_id should - * be set to the same value so that state associated with the old stream can - * be transferred to the new stream. The same client_id should not be used for - * different client instances. - * - * Generated from protobuf field string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getClientId() - { - return $this->client_id; - } - - /** - * Optional. A unique identifier that is used to distinguish client instances - * from each other. Only needs to be provided on the initial request. When a - * stream disconnects and reconnects for the same stream, the client_id should - * be set to the same value so that state associated with the old stream can - * be transferred to the new stream. The same client_id should not be used for - * different client instances. - * - * Generated from protobuf field string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setClientId($var) - { - GPBUtil::checkString($var, True); - $this->client_id = $var; - - return $this; - } - - /** - * Optional. Flow control settings for the maximum number of outstanding - * messages. When there are `max_outstanding_messages` currently sent to the - * streaming pull client that have not yet been acked or nacked, the server - * stops sending more messages. The sending of messages resumes once the - * number of outstanding messages is less than this value. If the value is - * <= 0, there is no limit to the number of outstanding messages. This - * property can only be set on the initial StreamingPullRequest. If it is set - * on a subsequent request, the stream will be aborted with status - * `INVALID_ARGUMENT`. - * - * Generated from protobuf field int64 max_outstanding_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @return int|string - */ - public function getMaxOutstandingMessages() - { - return $this->max_outstanding_messages; - } - - /** - * Optional. Flow control settings for the maximum number of outstanding - * messages. When there are `max_outstanding_messages` currently sent to the - * streaming pull client that have not yet been acked or nacked, the server - * stops sending more messages. The sending of messages resumes once the - * number of outstanding messages is less than this value. If the value is - * <= 0, there is no limit to the number of outstanding messages. This - * property can only be set on the initial StreamingPullRequest. If it is set - * on a subsequent request, the stream will be aborted with status - * `INVALID_ARGUMENT`. - * - * Generated from protobuf field int64 max_outstanding_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @param int|string $var - * @return $this - */ - public function setMaxOutstandingMessages($var) - { - GPBUtil::checkInt64($var); - $this->max_outstanding_messages = $var; - - return $this; - } - - /** - * Optional. Flow control settings for the maximum number of outstanding - * bytes. When there are `max_outstanding_bytes` or more worth of messages - * currently sent to the streaming pull client that have not yet been acked or - * nacked, the server will stop sending more messages. The sending of messages - * resumes once the number of outstanding bytes is less than this value. If - * the value is <= 0, there is no limit to the number of outstanding bytes. - * This property can only be set on the initial StreamingPullRequest. If it is - * set on a subsequent request, the stream will be aborted with status - * `INVALID_ARGUMENT`. - * - * Generated from protobuf field int64 max_outstanding_bytes = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @return int|string - */ - public function getMaxOutstandingBytes() - { - return $this->max_outstanding_bytes; - } - - /** - * Optional. Flow control settings for the maximum number of outstanding - * bytes. When there are `max_outstanding_bytes` or more worth of messages - * currently sent to the streaming pull client that have not yet been acked or - * nacked, the server will stop sending more messages. The sending of messages - * resumes once the number of outstanding bytes is less than this value. If - * the value is <= 0, there is no limit to the number of outstanding bytes. - * This property can only be set on the initial StreamingPullRequest. If it is - * set on a subsequent request, the stream will be aborted with status - * `INVALID_ARGUMENT`. - * - * Generated from protobuf field int64 max_outstanding_bytes = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @param int|string $var - * @return $this - */ - public function setMaxOutstandingBytes($var) - { - GPBUtil::checkInt64($var); - $this->max_outstanding_bytes = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse.php deleted file mode 100644 index 009b14fcc2aa..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse.php +++ /dev/null @@ -1,208 +0,0 @@ -google.pubsub.v1.StreamingPullResponse - */ -class StreamingPullResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. Received Pub/Sub messages. This will not be empty. - * - * Generated from protobuf field repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $received_messages; - /** - * Optional. This field will only be set if `enable_exactly_once_delivery` is - * set to `true`. - * - * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $acknowledge_confirmation = null; - /** - * Optional. This field will only be set if `enable_exactly_once_delivery` is - * set to `true`. - * - * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $modify_ack_deadline_confirmation = null; - /** - * Optional. Properties associated with this subscription. - * - * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $subscription_properties = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\PubSub\V1\ReceivedMessage>|\Google\Protobuf\Internal\RepeatedField $received_messages - * Optional. Received Pub/Sub messages. This will not be empty. - * @type \Google\Cloud\PubSub\V1\StreamingPullResponse\AcknowledgeConfirmation $acknowledge_confirmation - * Optional. This field will only be set if `enable_exactly_once_delivery` is - * set to `true`. - * @type \Google\Cloud\PubSub\V1\StreamingPullResponse\ModifyAckDeadlineConfirmation $modify_ack_deadline_confirmation - * Optional. This field will only be set if `enable_exactly_once_delivery` is - * set to `true`. - * @type \Google\Cloud\PubSub\V1\StreamingPullResponse\SubscriptionProperties $subscription_properties - * Optional. Properties associated with this subscription. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. Received Pub/Sub messages. This will not be empty. - * - * Generated from protobuf field repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getReceivedMessages() - { - return $this->received_messages; - } - - /** - * Optional. Received Pub/Sub messages. This will not be empty. - * - * Generated from protobuf field repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param array<\Google\Cloud\PubSub\V1\ReceivedMessage>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setReceivedMessages($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\ReceivedMessage::class); - $this->received_messages = $arr; - - return $this; - } - - /** - * Optional. This field will only be set if `enable_exactly_once_delivery` is - * set to `true`. - * - * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\StreamingPullResponse\AcknowledgeConfirmation|null - */ - public function getAcknowledgeConfirmation() - { - return $this->acknowledge_confirmation; - } - - public function hasAcknowledgeConfirmation() - { - return isset($this->acknowledge_confirmation); - } - - public function clearAcknowledgeConfirmation() - { - unset($this->acknowledge_confirmation); - } - - /** - * Optional. This field will only be set if `enable_exactly_once_delivery` is - * set to `true`. - * - * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\StreamingPullResponse\AcknowledgeConfirmation $var - * @return $this - */ - public function setAcknowledgeConfirmation($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\StreamingPullResponse\AcknowledgeConfirmation::class); - $this->acknowledge_confirmation = $var; - - return $this; - } - - /** - * Optional. This field will only be set if `enable_exactly_once_delivery` is - * set to `true`. - * - * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\StreamingPullResponse\ModifyAckDeadlineConfirmation|null - */ - public function getModifyAckDeadlineConfirmation() - { - return $this->modify_ack_deadline_confirmation; - } - - public function hasModifyAckDeadlineConfirmation() - { - return isset($this->modify_ack_deadline_confirmation); - } - - public function clearModifyAckDeadlineConfirmation() - { - unset($this->modify_ack_deadline_confirmation); - } - - /** - * Optional. This field will only be set if `enable_exactly_once_delivery` is - * set to `true`. - * - * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\StreamingPullResponse\ModifyAckDeadlineConfirmation $var - * @return $this - */ - public function setModifyAckDeadlineConfirmation($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\StreamingPullResponse\ModifyAckDeadlineConfirmation::class); - $this->modify_ack_deadline_confirmation = $var; - - return $this; - } - - /** - * Optional. Properties associated with this subscription. - * - * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\StreamingPullResponse\SubscriptionProperties|null - */ - public function getSubscriptionProperties() - { - return $this->subscription_properties; - } - - public function hasSubscriptionProperties() - { - return isset($this->subscription_properties); - } - - public function clearSubscriptionProperties() - { - unset($this->subscription_properties); - } - - /** - * Optional. Properties associated with this subscription. - * - * Generated from protobuf field .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\StreamingPullResponse\SubscriptionProperties $var - * @return $this - */ - public function setSubscriptionProperties($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\StreamingPullResponse\SubscriptionProperties::class); - $this->subscription_properties = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/AcknowledgeConfirmation.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/AcknowledgeConfirmation.php deleted file mode 100644 index fd94ce279a93..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/AcknowledgeConfirmation.php +++ /dev/null @@ -1,181 +0,0 @@ -google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation - */ -class AcknowledgeConfirmation extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. Successfully processed acknowledgement IDs. - * - * Generated from protobuf field repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $ack_ids; - /** - * Optional. List of acknowledgement IDs that were malformed or whose - * acknowledgement deadline has expired. - * - * Generated from protobuf field repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $invalid_ack_ids; - /** - * Optional. List of acknowledgement IDs that were out of order. - * - * Generated from protobuf field repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $unordered_ack_ids; - /** - * Optional. List of acknowledgement IDs that failed processing with - * temporary issues. - * - * Generated from protobuf field repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $temporary_failed_ack_ids; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $ack_ids - * Optional. Successfully processed acknowledgement IDs. - * @type array|\Google\Protobuf\Internal\RepeatedField $invalid_ack_ids - * Optional. List of acknowledgement IDs that were malformed or whose - * acknowledgement deadline has expired. - * @type array|\Google\Protobuf\Internal\RepeatedField $unordered_ack_ids - * Optional. List of acknowledgement IDs that were out of order. - * @type array|\Google\Protobuf\Internal\RepeatedField $temporary_failed_ack_ids - * Optional. List of acknowledgement IDs that failed processing with - * temporary issues. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. Successfully processed acknowledgement IDs. - * - * Generated from protobuf field repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getAckIds() - { - return $this->ack_ids; - } - - /** - * Optional. Successfully processed acknowledgement IDs. - * - * Generated from protobuf field repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setAckIds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->ack_ids = $arr; - - return $this; - } - - /** - * Optional. List of acknowledgement IDs that were malformed or whose - * acknowledgement deadline has expired. - * - * Generated from protobuf field repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getInvalidAckIds() - { - return $this->invalid_ack_ids; - } - - /** - * Optional. List of acknowledgement IDs that were malformed or whose - * acknowledgement deadline has expired. - * - * Generated from protobuf field repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setInvalidAckIds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->invalid_ack_ids = $arr; - - return $this; - } - - /** - * Optional. List of acknowledgement IDs that were out of order. - * - * Generated from protobuf field repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getUnorderedAckIds() - { - return $this->unordered_ack_ids; - } - - /** - * Optional. List of acknowledgement IDs that were out of order. - * - * Generated from protobuf field repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setUnorderedAckIds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->unordered_ack_ids = $arr; - - return $this; - } - - /** - * Optional. List of acknowledgement IDs that failed processing with - * temporary issues. - * - * Generated from protobuf field repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getTemporaryFailedAckIds() - { - return $this->temporary_failed_ack_ids; - } - - /** - * Optional. List of acknowledgement IDs that failed processing with - * temporary issues. - * - * Generated from protobuf field repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setTemporaryFailedAckIds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->temporary_failed_ack_ids = $arr; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(AcknowledgeConfirmation::class, \Google\Cloud\PubSub\V1\StreamingPullResponse_AcknowledgeConfirmation::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/ModifyAckDeadlineConfirmation.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/ModifyAckDeadlineConfirmation.php deleted file mode 100644 index 1fd67ae753a0..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/ModifyAckDeadlineConfirmation.php +++ /dev/null @@ -1,147 +0,0 @@ -google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation - */ -class ModifyAckDeadlineConfirmation extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. Successfully processed acknowledgement IDs. - * - * Generated from protobuf field repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $ack_ids; - /** - * Optional. List of acknowledgement IDs that were malformed or whose - * acknowledgement deadline has expired. - * - * Generated from protobuf field repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $invalid_ack_ids; - /** - * Optional. List of acknowledgement IDs that failed processing with - * temporary issues. - * - * Generated from protobuf field repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $temporary_failed_ack_ids; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $ack_ids - * Optional. Successfully processed acknowledgement IDs. - * @type array|\Google\Protobuf\Internal\RepeatedField $invalid_ack_ids - * Optional. List of acknowledgement IDs that were malformed or whose - * acknowledgement deadline has expired. - * @type array|\Google\Protobuf\Internal\RepeatedField $temporary_failed_ack_ids - * Optional. List of acknowledgement IDs that failed processing with - * temporary issues. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. Successfully processed acknowledgement IDs. - * - * Generated from protobuf field repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getAckIds() - { - return $this->ack_ids; - } - - /** - * Optional. Successfully processed acknowledgement IDs. - * - * Generated from protobuf field repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setAckIds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->ack_ids = $arr; - - return $this; - } - - /** - * Optional. List of acknowledgement IDs that were malformed or whose - * acknowledgement deadline has expired. - * - * Generated from protobuf field repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getInvalidAckIds() - { - return $this->invalid_ack_ids; - } - - /** - * Optional. List of acknowledgement IDs that were malformed or whose - * acknowledgement deadline has expired. - * - * Generated from protobuf field repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setInvalidAckIds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->invalid_ack_ids = $arr; - - return $this; - } - - /** - * Optional. List of acknowledgement IDs that failed processing with - * temporary issues. - * - * Generated from protobuf field repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getTemporaryFailedAckIds() - { - return $this->temporary_failed_ack_ids; - } - - /** - * Optional. List of acknowledgement IDs that failed processing with - * temporary issues. - * - * Generated from protobuf field repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setTemporaryFailedAckIds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->temporary_failed_ack_ids = $arr; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ModifyAckDeadlineConfirmation::class, \Google\Cloud\PubSub\V1\StreamingPullResponse_ModifyAckDeadlineConfirmation::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/SubscriptionProperties.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/SubscriptionProperties.php deleted file mode 100644 index f531ca2a7d55..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/StreamingPullResponse/SubscriptionProperties.php +++ /dev/null @@ -1,108 +0,0 @@ -google.pubsub.v1.StreamingPullResponse.SubscriptionProperties - */ -class SubscriptionProperties extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. True iff exactly once delivery is enabled for this - * subscription. - * - * Generated from protobuf field bool exactly_once_delivery_enabled = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $exactly_once_delivery_enabled = false; - /** - * Optional. True iff message ordering is enabled for this subscription. - * - * Generated from protobuf field bool message_ordering_enabled = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $message_ordering_enabled = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type bool $exactly_once_delivery_enabled - * Optional. True iff exactly once delivery is enabled for this - * subscription. - * @type bool $message_ordering_enabled - * Optional. True iff message ordering is enabled for this subscription. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Optional. True iff exactly once delivery is enabled for this - * subscription. - * - * Generated from protobuf field bool exactly_once_delivery_enabled = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getExactlyOnceDeliveryEnabled() - { - return $this->exactly_once_delivery_enabled; - } - - /** - * Optional. True iff exactly once delivery is enabled for this - * subscription. - * - * Generated from protobuf field bool exactly_once_delivery_enabled = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setExactlyOnceDeliveryEnabled($var) - { - GPBUtil::checkBool($var); - $this->exactly_once_delivery_enabled = $var; - - return $this; - } - - /** - * Optional. True iff message ordering is enabled for this subscription. - * - * Generated from protobuf field bool message_ordering_enabled = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getMessageOrderingEnabled() - { - return $this->message_ordering_enabled; - } - - /** - * Optional. True iff message ordering is enabled for this subscription. - * - * Generated from protobuf field bool message_ordering_enabled = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setMessageOrderingEnabled($var) - { - GPBUtil::checkBool($var); - $this->message_ordering_enabled = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(SubscriptionProperties::class, \Google\Cloud\PubSub\V1\StreamingPullResponse_SubscriptionProperties::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription.php deleted file mode 100644 index 349f59651b34..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription.php +++ /dev/null @@ -1,1090 +0,0 @@ -google.pubsub.v1.Subscription - */ -class Subscription extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the subscription. It must have the format - * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` 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"`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - /** - * Required. The name of the topic from which this subscription is receiving - * messages. Format is `projects/{project}/topics/{topic}`. The value of this - * field will be `_deleted-topic_` if the topic has been deleted. - * - * Generated from protobuf field string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $topic = ''; - /** - * Optional. If push delivery is used with this subscription, this field is - * used to configure it. - * - * Generated from protobuf field .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $push_config = null; - /** - * Optional. If delivery to BigQuery is used with this subscription, this - * field is used to configure it. - * - * Generated from protobuf field .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $bigquery_config = null; - /** - * Optional. If delivery to Google Cloud Storage is used with this - * subscription, this field is used to configure it. - * - * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $cloud_storage_config = null; - /** - * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub - * waits for the subscriber to acknowledge receipt before resending the - * message. In the interval after the message is delivered and before it is - * acknowledged, it is considered to be _outstanding_. During that time - * period, the message will not be redelivered (on a best-effort basis). - * For pull subscriptions, this value is used as the initial value for the ack - * deadline. To override this value for a given message, call - * `ModifyAckDeadline` with the corresponding `ack_id` if using - * non-streaming pull or send the `ack_id` in a - * `StreamingModifyAckDeadlineRequest` if using streaming pull. - * The minimum custom deadline you can specify is 10 seconds. - * The maximum custom deadline you can specify is 600 seconds (10 minutes). - * If this parameter is 0, a default value of 10 seconds is used. - * For push delivery, this value is also used to set the request timeout for - * the call to the push endpoint. - * If the subscriber never acknowledges the message, the Pub/Sub - * system will eventually redeliver the message. - * - * Generated from protobuf field int32 ack_deadline_seconds = 5 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $ack_deadline_seconds = 0; - /** - * Optional. Indicates whether to retain acknowledged messages. If true, then - * messages are not expunged from the subscription's backlog, even if they are - * acknowledged, until they fall out of the `message_retention_duration` - * window. This must be true if you would like to [`Seek` to a timestamp] - * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in - * the past to replay previously-acknowledged messages. - * - * Generated from protobuf field bool retain_acked_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $retain_acked_messages = false; - /** - * Optional. How long to retain unacknowledged messages in the subscription's - * backlog, from the moment a message is published. If `retain_acked_messages` - * is true, then this also configures the retention of acknowledged messages, - * and thus configures how far back in time a `Seek` can be done. Defaults to - * 7 days. Cannot be more than 7 days or less than 10 minutes. - * - * Generated from protobuf field .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $message_retention_duration = null; - /** - * Optional. See [Creating and managing - * labels](https://cloud.google.com/pubsub/docs/labels). - * - * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $labels; - /** - * Optional. If true, messages published with the same `ordering_key` in - * `PubsubMessage` will be delivered to the subscribers in the order in which - * they are received by the Pub/Sub system. Otherwise, they may be delivered - * in any order. - * - * Generated from protobuf field bool enable_message_ordering = 10 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $enable_message_ordering = false; - /** - * Optional. A policy that specifies the conditions for this subscription's - * expiration. A subscription is considered active as long as any connected - * subscriber is successfully consuming messages from the subscription or is - * issuing operations on the subscription. If `expiration_policy` is not set, - * a *default policy* with `ttl` of 31 days will be used. The minimum allowed - * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set, - * but `expiration_policy.ttl` is not set, the subscription never expires. - * - * Generated from protobuf field .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $expiration_policy = null; - /** - * Optional. An expression written in the Pub/Sub [filter - * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, - * then only `PubsubMessage`s whose `attributes` field matches the filter are - * delivered on this subscription. If empty, then no messages are filtered - * out. - * - * Generated from protobuf field string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $filter = ''; - /** - * Optional. A policy that specifies the conditions for dead lettering - * messages in this subscription. If dead_letter_policy is not set, dead - * lettering is disabled. - * The Pub/Sub service account associated with this subscriptions's - * parent project (i.e., - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have - * permission to Acknowledge() messages on this subscription. - * - * Generated from protobuf field .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $dead_letter_policy = null; - /** - * Optional. A policy that specifies how Pub/Sub retries message delivery for - * this subscription. - * If not set, the default retry policy is applied. This generally implies - * that messages will be retried as soon as possible for healthy subscribers. - * RetryPolicy will be triggered on NACKs or acknowledgement deadline - * exceeded events for a given message. - * - * Generated from protobuf field .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $retry_policy = null; - /** - * Optional. Indicates whether the subscription is detached from its topic. - * Detached subscriptions don't receive messages from their topic and don't - * retain any backlog. `Pull` and `StreamingPull` requests will return - * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to - * the endpoint will not be made. - * - * Generated from protobuf field bool detached = 15 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $detached = false; - /** - * Optional. If true, Pub/Sub provides the following guarantees for the - * delivery of a message with a given value of `message_id` on this - * subscription: - * * The message sent to a subscriber is guaranteed not to be resent - * before the message's acknowledgement deadline expires. - * * An acknowledged message will not be resent to a subscriber. - * Note that subscribers may still receive multiple copies of a message - * when `enable_exactly_once_delivery` is true if the message was published - * multiple times by a publisher client. These copies are considered distinct - * by Pub/Sub and have distinct `message_id` values. - * - * Generated from protobuf field bool enable_exactly_once_delivery = 16 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $enable_exactly_once_delivery = false; - /** - * Output only. Indicates the minimum duration for which a message is retained - * after it is published to the subscription's topic. If this field is set, - * messages published to the subscription's topic in the last - * `topic_message_retention_duration` are always available to subscribers. See - * the `message_retention_duration` field in `Topic`. This field is set only - * in responses from the server; it is ignored if it is set in any requests. - * - * Generated from protobuf field .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $topic_message_retention_duration = null; - /** - * Output only. An output-only field indicating whether or not the - * subscription can receive messages. - * - * Generated from protobuf field .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 0; - - /** - * @param string $name Required. The name of the subscription. It must have the format - * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` 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"`. - * @param string $topic Required. The name of the topic from which this subscription is receiving - * messages. Format is `projects/{project}/topics/{topic}`. The value of this - * field will be `_deleted-topic_` if the topic has been deleted. Please see - * {@see SubscriberClient::topicName()} for help formatting this field. - * @param \Google\Cloud\PubSub\V1\PushConfig $pushConfig Optional. If push delivery is used with this subscription, this field is - * used to configure it. - * @param int $ackDeadlineSeconds Optional. The approximate amount of time (on a best-effort basis) Pub/Sub - * waits for the subscriber to acknowledge receipt before resending the - * message. In the interval after the message is delivered and before it is - * acknowledged, it is considered to be _outstanding_. During that time - * period, the message will not be redelivered (on a best-effort basis). - * - * For pull subscriptions, this value is used as the initial value for the ack - * deadline. To override this value for a given message, call - * `ModifyAckDeadline` with the corresponding `ack_id` if using - * non-streaming pull or send the `ack_id` in a - * `StreamingModifyAckDeadlineRequest` if using streaming pull. - * The minimum custom deadline you can specify is 10 seconds. - * The maximum custom deadline you can specify is 600 seconds (10 minutes). - * If this parameter is 0, a default value of 10 seconds is used. - * - * For push delivery, this value is also used to set the request timeout for - * the call to the push endpoint. - * - * If the subscriber never acknowledges the message, the Pub/Sub - * system will eventually redeliver the message. - * - * @return \Google\Cloud\PubSub\V1\Subscription - * - * @experimental - */ - public static function build(string $name, string $topic, \Google\Cloud\PubSub\V1\PushConfig $pushConfig, int $ackDeadlineSeconds): self - { - return (new self()) - ->setName($name) - ->setTopic($topic) - ->setPushConfig($pushConfig) - ->setAckDeadlineSeconds($ackDeadlineSeconds); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the subscription. It must have the format - * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` 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"`. - * @type string $topic - * Required. The name of the topic from which this subscription is receiving - * messages. Format is `projects/{project}/topics/{topic}`. The value of this - * field will be `_deleted-topic_` if the topic has been deleted. - * @type \Google\Cloud\PubSub\V1\PushConfig $push_config - * Optional. If push delivery is used with this subscription, this field is - * used to configure it. - * @type \Google\Cloud\PubSub\V1\BigQueryConfig $bigquery_config - * Optional. If delivery to BigQuery is used with this subscription, this - * field is used to configure it. - * @type \Google\Cloud\PubSub\V1\CloudStorageConfig $cloud_storage_config - * Optional. If delivery to Google Cloud Storage is used with this - * subscription, this field is used to configure it. - * @type int $ack_deadline_seconds - * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub - * waits for the subscriber to acknowledge receipt before resending the - * message. In the interval after the message is delivered and before it is - * acknowledged, it is considered to be _outstanding_. During that time - * period, the message will not be redelivered (on a best-effort basis). - * For pull subscriptions, this value is used as the initial value for the ack - * deadline. To override this value for a given message, call - * `ModifyAckDeadline` with the corresponding `ack_id` if using - * non-streaming pull or send the `ack_id` in a - * `StreamingModifyAckDeadlineRequest` if using streaming pull. - * The minimum custom deadline you can specify is 10 seconds. - * The maximum custom deadline you can specify is 600 seconds (10 minutes). - * If this parameter is 0, a default value of 10 seconds is used. - * For push delivery, this value is also used to set the request timeout for - * the call to the push endpoint. - * If the subscriber never acknowledges the message, the Pub/Sub - * system will eventually redeliver the message. - * @type bool $retain_acked_messages - * Optional. Indicates whether to retain acknowledged messages. If true, then - * messages are not expunged from the subscription's backlog, even if they are - * acknowledged, until they fall out of the `message_retention_duration` - * window. This must be true if you would like to [`Seek` to a timestamp] - * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in - * the past to replay previously-acknowledged messages. - * @type \Google\Protobuf\Duration $message_retention_duration - * Optional. How long to retain unacknowledged messages in the subscription's - * backlog, from the moment a message is published. If `retain_acked_messages` - * is true, then this also configures the retention of acknowledged messages, - * and thus configures how far back in time a `Seek` can be done. Defaults to - * 7 days. Cannot be more than 7 days or less than 10 minutes. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Optional. See [Creating and managing - * labels](https://cloud.google.com/pubsub/docs/labels). - * @type bool $enable_message_ordering - * Optional. If true, messages published with the same `ordering_key` in - * `PubsubMessage` will be delivered to the subscribers in the order in which - * they are received by the Pub/Sub system. Otherwise, they may be delivered - * in any order. - * @type \Google\Cloud\PubSub\V1\ExpirationPolicy $expiration_policy - * Optional. A policy that specifies the conditions for this subscription's - * expiration. A subscription is considered active as long as any connected - * subscriber is successfully consuming messages from the subscription or is - * issuing operations on the subscription. If `expiration_policy` is not set, - * a *default policy* with `ttl` of 31 days will be used. The minimum allowed - * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set, - * but `expiration_policy.ttl` is not set, the subscription never expires. - * @type string $filter - * Optional. An expression written in the Pub/Sub [filter - * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, - * then only `PubsubMessage`s whose `attributes` field matches the filter are - * delivered on this subscription. If empty, then no messages are filtered - * out. - * @type \Google\Cloud\PubSub\V1\DeadLetterPolicy $dead_letter_policy - * Optional. A policy that specifies the conditions for dead lettering - * messages in this subscription. If dead_letter_policy is not set, dead - * lettering is disabled. - * The Pub/Sub service account associated with this subscriptions's - * parent project (i.e., - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have - * permission to Acknowledge() messages on this subscription. - * @type \Google\Cloud\PubSub\V1\RetryPolicy $retry_policy - * Optional. A policy that specifies how Pub/Sub retries message delivery for - * this subscription. - * If not set, the default retry policy is applied. This generally implies - * that messages will be retried as soon as possible for healthy subscribers. - * RetryPolicy will be triggered on NACKs or acknowledgement deadline - * exceeded events for a given message. - * @type bool $detached - * Optional. Indicates whether the subscription is detached from its topic. - * Detached subscriptions don't receive messages from their topic and don't - * retain any backlog. `Pull` and `StreamingPull` requests will return - * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to - * the endpoint will not be made. - * @type bool $enable_exactly_once_delivery - * Optional. If true, Pub/Sub provides the following guarantees for the - * delivery of a message with a given value of `message_id` on this - * subscription: - * * The message sent to a subscriber is guaranteed not to be resent - * before the message's acknowledgement deadline expires. - * * An acknowledged message will not be resent to a subscriber. - * Note that subscribers may still receive multiple copies of a message - * when `enable_exactly_once_delivery` is true if the message was published - * multiple times by a publisher client. These copies are considered distinct - * by Pub/Sub and have distinct `message_id` values. - * @type \Google\Protobuf\Duration $topic_message_retention_duration - * Output only. Indicates the minimum duration for which a message is retained - * after it is published to the subscription's topic. If this field is set, - * messages published to the subscription's topic in the last - * `topic_message_retention_duration` are always available to subscribers. See - * the `message_retention_duration` field in `Topic`. This field is set only - * in responses from the server; it is ignored if it is set in any requests. - * @type int $state - * Output only. An output-only field indicating whether or not the - * subscription can receive messages. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the subscription. It must have the format - * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` 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"`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the subscription. It must have the format - * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` 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"`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Required. The name of the topic from which this subscription is receiving - * messages. Format is `projects/{project}/topics/{topic}`. The value of this - * field will be `_deleted-topic_` if the topic has been deleted. - * - * Generated from protobuf field string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getTopic() - { - return $this->topic; - } - - /** - * Required. The name of the topic from which this subscription is receiving - * messages. Format is `projects/{project}/topics/{topic}`. The value of this - * field will be `_deleted-topic_` if the topic has been deleted. - * - * Generated from protobuf field string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setTopic($var) - { - GPBUtil::checkString($var, True); - $this->topic = $var; - - return $this; - } - - /** - * Optional. If push delivery is used with this subscription, this field is - * used to configure it. - * - * Generated from protobuf field .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\PushConfig|null - */ - public function getPushConfig() - { - return $this->push_config; - } - - public function hasPushConfig() - { - return isset($this->push_config); - } - - public function clearPushConfig() - { - unset($this->push_config); - } - - /** - * Optional. If push delivery is used with this subscription, this field is - * used to configure it. - * - * Generated from protobuf field .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\PushConfig $var - * @return $this - */ - public function setPushConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PushConfig::class); - $this->push_config = $var; - - return $this; - } - - /** - * Optional. If delivery to BigQuery is used with this subscription, this - * field is used to configure it. - * - * Generated from protobuf field .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\BigQueryConfig|null - */ - public function getBigqueryConfig() - { - return $this->bigquery_config; - } - - public function hasBigqueryConfig() - { - return isset($this->bigquery_config); - } - - public function clearBigqueryConfig() - { - unset($this->bigquery_config); - } - - /** - * Optional. If delivery to BigQuery is used with this subscription, this - * field is used to configure it. - * - * Generated from protobuf field .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\BigQueryConfig $var - * @return $this - */ - public function setBigqueryConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\BigQueryConfig::class); - $this->bigquery_config = $var; - - return $this; - } - - /** - * Optional. If delivery to Google Cloud Storage is used with this - * subscription, this field is used to configure it. - * - * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\CloudStorageConfig|null - */ - public function getCloudStorageConfig() - { - return $this->cloud_storage_config; - } - - public function hasCloudStorageConfig() - { - return isset($this->cloud_storage_config); - } - - public function clearCloudStorageConfig() - { - unset($this->cloud_storage_config); - } - - /** - * Optional. If delivery to Google Cloud Storage is used with this - * subscription, this field is used to configure it. - * - * Generated from protobuf field .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\CloudStorageConfig $var - * @return $this - */ - public function setCloudStorageConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\CloudStorageConfig::class); - $this->cloud_storage_config = $var; - - return $this; - } - - /** - * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub - * waits for the subscriber to acknowledge receipt before resending the - * message. In the interval after the message is delivered and before it is - * acknowledged, it is considered to be _outstanding_. During that time - * period, the message will not be redelivered (on a best-effort basis). - * For pull subscriptions, this value is used as the initial value for the ack - * deadline. To override this value for a given message, call - * `ModifyAckDeadline` with the corresponding `ack_id` if using - * non-streaming pull or send the `ack_id` in a - * `StreamingModifyAckDeadlineRequest` if using streaming pull. - * The minimum custom deadline you can specify is 10 seconds. - * The maximum custom deadline you can specify is 600 seconds (10 minutes). - * If this parameter is 0, a default value of 10 seconds is used. - * For push delivery, this value is also used to set the request timeout for - * the call to the push endpoint. - * If the subscriber never acknowledges the message, the Pub/Sub - * system will eventually redeliver the message. - * - * Generated from protobuf field int32 ack_deadline_seconds = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getAckDeadlineSeconds() - { - return $this->ack_deadline_seconds; - } - - /** - * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub - * waits for the subscriber to acknowledge receipt before resending the - * message. In the interval after the message is delivered and before it is - * acknowledged, it is considered to be _outstanding_. During that time - * period, the message will not be redelivered (on a best-effort basis). - * For pull subscriptions, this value is used as the initial value for the ack - * deadline. To override this value for a given message, call - * `ModifyAckDeadline` with the corresponding `ack_id` if using - * non-streaming pull or send the `ack_id` in a - * `StreamingModifyAckDeadlineRequest` if using streaming pull. - * The minimum custom deadline you can specify is 10 seconds. - * The maximum custom deadline you can specify is 600 seconds (10 minutes). - * If this parameter is 0, a default value of 10 seconds is used. - * For push delivery, this value is also used to set the request timeout for - * the call to the push endpoint. - * If the subscriber never acknowledges the message, the Pub/Sub - * system will eventually redeliver the message. - * - * Generated from protobuf field int32 ack_deadline_seconds = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setAckDeadlineSeconds($var) - { - GPBUtil::checkInt32($var); - $this->ack_deadline_seconds = $var; - - return $this; - } - - /** - * Optional. Indicates whether to retain acknowledged messages. If true, then - * messages are not expunged from the subscription's backlog, even if they are - * acknowledged, until they fall out of the `message_retention_duration` - * window. This must be true if you would like to [`Seek` to a timestamp] - * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in - * the past to replay previously-acknowledged messages. - * - * Generated from protobuf field bool retain_acked_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getRetainAckedMessages() - { - return $this->retain_acked_messages; - } - - /** - * Optional. Indicates whether to retain acknowledged messages. If true, then - * messages are not expunged from the subscription's backlog, even if they are - * acknowledged, until they fall out of the `message_retention_duration` - * window. This must be true if you would like to [`Seek` to a timestamp] - * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in - * the past to replay previously-acknowledged messages. - * - * Generated from protobuf field bool retain_acked_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setRetainAckedMessages($var) - { - GPBUtil::checkBool($var); - $this->retain_acked_messages = $var; - - return $this; - } - - /** - * Optional. How long to retain unacknowledged messages in the subscription's - * backlog, from the moment a message is published. If `retain_acked_messages` - * is true, then this also configures the retention of acknowledged messages, - * and thus configures how far back in time a `Seek` can be done. Defaults to - * 7 days. Cannot be more than 7 days or less than 10 minutes. - * - * Generated from protobuf field .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Duration|null - */ - public function getMessageRetentionDuration() - { - return $this->message_retention_duration; - } - - public function hasMessageRetentionDuration() - { - return isset($this->message_retention_duration); - } - - public function clearMessageRetentionDuration() - { - unset($this->message_retention_duration); - } - - /** - * Optional. How long to retain unacknowledged messages in the subscription's - * backlog, from the moment a message is published. If `retain_acked_messages` - * is true, then this also configures the retention of acknowledged messages, - * and thus configures how far back in time a `Seek` can be done. Defaults to - * 7 days. Cannot be more than 7 days or less than 10 minutes. - * - * Generated from protobuf field .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setMessageRetentionDuration($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->message_retention_duration = $var; - - return $this; - } - - /** - * Optional. See [Creating and managing - * labels](https://cloud.google.com/pubsub/docs/labels). - * - * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Optional. See [Creating and managing - * labels](https://cloud.google.com/pubsub/docs/labels). - * - * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setLabels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->labels = $arr; - - return $this; - } - - /** - * Optional. If true, messages published with the same `ordering_key` in - * `PubsubMessage` will be delivered to the subscribers in the order in which - * they are received by the Pub/Sub system. Otherwise, they may be delivered - * in any order. - * - * Generated from protobuf field bool enable_message_ordering = 10 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getEnableMessageOrdering() - { - return $this->enable_message_ordering; - } - - /** - * Optional. If true, messages published with the same `ordering_key` in - * `PubsubMessage` will be delivered to the subscribers in the order in which - * they are received by the Pub/Sub system. Otherwise, they may be delivered - * in any order. - * - * Generated from protobuf field bool enable_message_ordering = 10 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setEnableMessageOrdering($var) - { - GPBUtil::checkBool($var); - $this->enable_message_ordering = $var; - - return $this; - } - - /** - * Optional. A policy that specifies the conditions for this subscription's - * expiration. A subscription is considered active as long as any connected - * subscriber is successfully consuming messages from the subscription or is - * issuing operations on the subscription. If `expiration_policy` is not set, - * a *default policy* with `ttl` of 31 days will be used. The minimum allowed - * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set, - * but `expiration_policy.ttl` is not set, the subscription never expires. - * - * Generated from protobuf field .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\ExpirationPolicy|null - */ - public function getExpirationPolicy() - { - return $this->expiration_policy; - } - - public function hasExpirationPolicy() - { - return isset($this->expiration_policy); - } - - public function clearExpirationPolicy() - { - unset($this->expiration_policy); - } - - /** - * Optional. A policy that specifies the conditions for this subscription's - * expiration. A subscription is considered active as long as any connected - * subscriber is successfully consuming messages from the subscription or is - * issuing operations on the subscription. If `expiration_policy` is not set, - * a *default policy* with `ttl` of 31 days will be used. The minimum allowed - * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set, - * but `expiration_policy.ttl` is not set, the subscription never expires. - * - * Generated from protobuf field .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\ExpirationPolicy $var - * @return $this - */ - public function setExpirationPolicy($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\ExpirationPolicy::class); - $this->expiration_policy = $var; - - return $this; - } - - /** - * Optional. An expression written in the Pub/Sub [filter - * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, - * then only `PubsubMessage`s whose `attributes` field matches the filter are - * delivered on this subscription. If empty, then no messages are filtered - * out. - * - * Generated from protobuf field string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * Optional. An expression written in the Pub/Sub [filter - * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, - * then only `PubsubMessage`s whose `attributes` field matches the filter are - * delivered on this subscription. If empty, then no messages are filtered - * out. - * - * Generated from protobuf field string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - - /** - * Optional. A policy that specifies the conditions for dead lettering - * messages in this subscription. If dead_letter_policy is not set, dead - * lettering is disabled. - * The Pub/Sub service account associated with this subscriptions's - * parent project (i.e., - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have - * permission to Acknowledge() messages on this subscription. - * - * Generated from protobuf field .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\DeadLetterPolicy|null - */ - public function getDeadLetterPolicy() - { - return $this->dead_letter_policy; - } - - public function hasDeadLetterPolicy() - { - return isset($this->dead_letter_policy); - } - - public function clearDeadLetterPolicy() - { - unset($this->dead_letter_policy); - } - - /** - * Optional. A policy that specifies the conditions for dead lettering - * messages in this subscription. If dead_letter_policy is not set, dead - * lettering is disabled. - * The Pub/Sub service account associated with this subscriptions's - * parent project (i.e., - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have - * permission to Acknowledge() messages on this subscription. - * - * Generated from protobuf field .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\DeadLetterPolicy $var - * @return $this - */ - public function setDeadLetterPolicy($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\DeadLetterPolicy::class); - $this->dead_letter_policy = $var; - - return $this; - } - - /** - * Optional. A policy that specifies how Pub/Sub retries message delivery for - * this subscription. - * If not set, the default retry policy is applied. This generally implies - * that messages will be retried as soon as possible for healthy subscribers. - * RetryPolicy will be triggered on NACKs or acknowledgement deadline - * exceeded events for a given message. - * - * Generated from protobuf field .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\RetryPolicy|null - */ - public function getRetryPolicy() - { - return $this->retry_policy; - } - - public function hasRetryPolicy() - { - return isset($this->retry_policy); - } - - public function clearRetryPolicy() - { - unset($this->retry_policy); - } - - /** - * Optional. A policy that specifies how Pub/Sub retries message delivery for - * this subscription. - * If not set, the default retry policy is applied. This generally implies - * that messages will be retried as soon as possible for healthy subscribers. - * RetryPolicy will be triggered on NACKs or acknowledgement deadline - * exceeded events for a given message. - * - * Generated from protobuf field .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\RetryPolicy $var - * @return $this - */ - public function setRetryPolicy($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\RetryPolicy::class); - $this->retry_policy = $var; - - return $this; - } - - /** - * Optional. Indicates whether the subscription is detached from its topic. - * Detached subscriptions don't receive messages from their topic and don't - * retain any backlog. `Pull` and `StreamingPull` requests will return - * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to - * the endpoint will not be made. - * - * Generated from protobuf field bool detached = 15 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getDetached() - { - return $this->detached; - } - - /** - * Optional. Indicates whether the subscription is detached from its topic. - * Detached subscriptions don't receive messages from their topic and don't - * retain any backlog. `Pull` and `StreamingPull` requests will return - * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to - * the endpoint will not be made. - * - * Generated from protobuf field bool detached = 15 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setDetached($var) - { - GPBUtil::checkBool($var); - $this->detached = $var; - - return $this; - } - - /** - * Optional. If true, Pub/Sub provides the following guarantees for the - * delivery of a message with a given value of `message_id` on this - * subscription: - * * The message sent to a subscriber is guaranteed not to be resent - * before the message's acknowledgement deadline expires. - * * An acknowledged message will not be resent to a subscriber. - * Note that subscribers may still receive multiple copies of a message - * when `enable_exactly_once_delivery` is true if the message was published - * multiple times by a publisher client. These copies are considered distinct - * by Pub/Sub and have distinct `message_id` values. - * - * Generated from protobuf field bool enable_exactly_once_delivery = 16 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getEnableExactlyOnceDelivery() - { - return $this->enable_exactly_once_delivery; - } - - /** - * Optional. If true, Pub/Sub provides the following guarantees for the - * delivery of a message with a given value of `message_id` on this - * subscription: - * * The message sent to a subscriber is guaranteed not to be resent - * before the message's acknowledgement deadline expires. - * * An acknowledged message will not be resent to a subscriber. - * Note that subscribers may still receive multiple copies of a message - * when `enable_exactly_once_delivery` is true if the message was published - * multiple times by a publisher client. These copies are considered distinct - * by Pub/Sub and have distinct `message_id` values. - * - * Generated from protobuf field bool enable_exactly_once_delivery = 16 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setEnableExactlyOnceDelivery($var) - { - GPBUtil::checkBool($var); - $this->enable_exactly_once_delivery = $var; - - return $this; - } - - /** - * Output only. Indicates the minimum duration for which a message is retained - * after it is published to the subscription's topic. If this field is set, - * messages published to the subscription's topic in the last - * `topic_message_retention_duration` are always available to subscribers. See - * the `message_retention_duration` field in `Topic`. This field is set only - * in responses from the server; it is ignored if it is set in any requests. - * - * Generated from protobuf field .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Duration|null - */ - public function getTopicMessageRetentionDuration() - { - return $this->topic_message_retention_duration; - } - - public function hasTopicMessageRetentionDuration() - { - return isset($this->topic_message_retention_duration); - } - - public function clearTopicMessageRetentionDuration() - { - unset($this->topic_message_retention_duration); - } - - /** - * Output only. Indicates the minimum duration for which a message is retained - * after it is published to the subscription's topic. If this field is set, - * messages published to the subscription's topic in the last - * `topic_message_retention_duration` are always available to subscribers. See - * the `message_retention_duration` field in `Topic`. This field is set only - * in responses from the server; it is ignored if it is set in any requests. - * - * Generated from protobuf field .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setTopicMessageRetentionDuration($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->topic_message_retention_duration = $var; - - return $this; - } - - /** - * Output only. An output-only field indicating whether or not the - * subscription can receive messages. - * - * Generated from protobuf field .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. An output-only field indicating whether or not the - * subscription can receive messages. - * - * Generated from protobuf field .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\Subscription\State::class); - $this->state = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription/State.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription/State.php deleted file mode 100644 index 9dd0c05877eb..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Subscription/State.php +++ /dev/null @@ -1,66 +0,0 @@ -google.pubsub.v1.Subscription.State - */ -class State -{ - /** - * Default value. This value is unused. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * The subscription can actively receive messages - * - * Generated from protobuf enum ACTIVE = 1; - */ - const ACTIVE = 1; - /** - * The subscription cannot receive messages because of an error with the - * resource to which it pushes messages. See the more detailed error state - * in the corresponding configuration. - * - * Generated from protobuf enum RESOURCE_ERROR = 2; - */ - const RESOURCE_ERROR = 2; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::ACTIVE => 'ACTIVE', - self::RESOURCE_ERROR => 'RESOURCE_ERROR', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\PubSub\V1\Subscription_State::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic.php deleted file mode 100644 index aa0e5f0fca36..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic.php +++ /dev/null @@ -1,473 +0,0 @@ -google.pubsub.v1.Topic - */ -class Topic extends \Google\Protobuf\Internal\Message -{ - /** - * 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"`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - /** - * Optional. See [Creating and managing labels] - * (https://cloud.google.com/pubsub/docs/labels). - * - * Generated from protobuf field map labels = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $labels; - /** - * Optional. Policy constraining the set of Google Cloud Platform regions - * where messages published to the topic may be stored. If not present, then - * no constraints are in effect. - * - * Generated from protobuf field .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $message_storage_policy = null; - /** - * Optional. The resource name of the Cloud KMS CryptoKey to be used to - * protect access to messages published on this topic. - * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - * - * Generated from protobuf field string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $kms_key_name = ''; - /** - * Optional. Settings for validating messages published against a schema. - * - * Generated from protobuf field .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $schema_settings = null; - /** - * Optional. Reserved for future use. This field is set only in responses from - * the server; it is ignored if it is set in any requests. - * - * Generated from protobuf field bool satisfies_pzs = 7 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $satisfies_pzs = false; - /** - * Optional. Indicates the minimum duration to retain a message after it is - * published to the topic. If this field is set, messages published to the - * topic in the last `message_retention_duration` are always available to - * subscribers. For instance, it allows any attached subscription to [seek to - * a - * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) - * that is up to `message_retention_duration` in the past. If this field is - * not set, message retention is controlled by settings on individual - * subscriptions. Cannot be more than 31 days or less than 10 minutes. - * - * Generated from protobuf field .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $message_retention_duration = null; - /** - * Output only. An output-only field indicating the state of the topic. - * - * Generated from protobuf field .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 0; - /** - * Optional. Settings for ingestion from a data source into this topic. - * - * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $ingestion_data_source_settings = null; - - /** - * @param 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"`. - * - * @return \Google\Cloud\PubSub\V1\Topic - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type 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"`. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Optional. See [Creating and managing labels] - * (https://cloud.google.com/pubsub/docs/labels). - * @type \Google\Cloud\PubSub\V1\MessageStoragePolicy $message_storage_policy - * Optional. Policy constraining the set of Google Cloud Platform regions - * where messages published to the topic may be stored. If not present, then - * no constraints are in effect. - * @type string $kms_key_name - * Optional. The resource name of the Cloud KMS CryptoKey to be used to - * protect access to messages published on this topic. - * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - * @type \Google\Cloud\PubSub\V1\SchemaSettings $schema_settings - * Optional. Settings for validating messages published against a schema. - * @type bool $satisfies_pzs - * Optional. Reserved for future use. This field is set only in responses from - * the server; it is ignored if it is set in any requests. - * @type \Google\Protobuf\Duration $message_retention_duration - * Optional. Indicates the minimum duration to retain a message after it is - * published to the topic. If this field is set, messages published to the - * topic in the last `message_retention_duration` are always available to - * subscribers. For instance, it allows any attached subscription to [seek to - * a - * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) - * that is up to `message_retention_duration` in the past. If this field is - * not set, message retention is controlled by settings on individual - * subscriptions. Cannot be more than 31 days or less than 10 minutes. - * @type int $state - * Output only. An output-only field indicating the state of the topic. - * @type \Google\Cloud\PubSub\V1\IngestionDataSourceSettings $ingestion_data_source_settings - * Optional. Settings for ingestion from a data source into this topic. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * 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"`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->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"`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Optional. See [Creating and managing labels] - * (https://cloud.google.com/pubsub/docs/labels). - * - * Generated from protobuf field map labels = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Optional. See [Creating and managing labels] - * (https://cloud.google.com/pubsub/docs/labels). - * - * Generated from protobuf field map labels = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setLabels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->labels = $arr; - - return $this; - } - - /** - * Optional. Policy constraining the set of Google Cloud Platform regions - * where messages published to the topic may be stored. If not present, then - * no constraints are in effect. - * - * Generated from protobuf field .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\MessageStoragePolicy|null - */ - public function getMessageStoragePolicy() - { - return $this->message_storage_policy; - } - - public function hasMessageStoragePolicy() - { - return isset($this->message_storage_policy); - } - - public function clearMessageStoragePolicy() - { - unset($this->message_storage_policy); - } - - /** - * Optional. Policy constraining the set of Google Cloud Platform regions - * where messages published to the topic may be stored. If not present, then - * no constraints are in effect. - * - * Generated from protobuf field .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\MessageStoragePolicy $var - * @return $this - */ - public function setMessageStoragePolicy($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\MessageStoragePolicy::class); - $this->message_storage_policy = $var; - - return $this; - } - - /** - * Optional. The resource name of the Cloud KMS CryptoKey to be used to - * protect access to messages published on this topic. - * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - * - * Generated from protobuf field string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getKmsKeyName() - { - return $this->kms_key_name; - } - - /** - * Optional. The resource name of the Cloud KMS CryptoKey to be used to - * protect access to messages published on this topic. - * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - * - * Generated from protobuf field string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setKmsKeyName($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_name = $var; - - return $this; - } - - /** - * Optional. Settings for validating messages published against a schema. - * - * Generated from protobuf field .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\SchemaSettings|null - */ - public function getSchemaSettings() - { - return $this->schema_settings; - } - - public function hasSchemaSettings() - { - return isset($this->schema_settings); - } - - public function clearSchemaSettings() - { - unset($this->schema_settings); - } - - /** - * Optional. Settings for validating messages published against a schema. - * - * Generated from protobuf field .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\SchemaSettings $var - * @return $this - */ - public function setSchemaSettings($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\SchemaSettings::class); - $this->schema_settings = $var; - - return $this; - } - - /** - * Optional. Reserved for future use. This field is set only in responses from - * the server; it is ignored if it is set in any requests. - * - * Generated from protobuf field bool satisfies_pzs = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getSatisfiesPzs() - { - return $this->satisfies_pzs; - } - - /** - * Optional. Reserved for future use. This field is set only in responses from - * the server; it is ignored if it is set in any requests. - * - * Generated from protobuf field bool satisfies_pzs = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setSatisfiesPzs($var) - { - GPBUtil::checkBool($var); - $this->satisfies_pzs = $var; - - return $this; - } - - /** - * Optional. Indicates the minimum duration to retain a message after it is - * published to the topic. If this field is set, messages published to the - * topic in the last `message_retention_duration` are always available to - * subscribers. For instance, it allows any attached subscription to [seek to - * a - * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) - * that is up to `message_retention_duration` in the past. If this field is - * not set, message retention is controlled by settings on individual - * subscriptions. Cannot be more than 31 days or less than 10 minutes. - * - * Generated from protobuf field .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Duration|null - */ - public function getMessageRetentionDuration() - { - return $this->message_retention_duration; - } - - public function hasMessageRetentionDuration() - { - return isset($this->message_retention_duration); - } - - public function clearMessageRetentionDuration() - { - unset($this->message_retention_duration); - } - - /** - * Optional. Indicates the minimum duration to retain a message after it is - * published to the topic. If this field is set, messages published to the - * topic in the last `message_retention_duration` are always available to - * subscribers. For instance, it allows any attached subscription to [seek to - * a - * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) - * that is up to `message_retention_duration` in the past. If this field is - * not set, message retention is controlled by settings on individual - * subscriptions. Cannot be more than 31 days or less than 10 minutes. - * - * Generated from protobuf field .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setMessageRetentionDuration($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->message_retention_duration = $var; - - return $this; - } - - /** - * Output only. An output-only field indicating the state of the topic. - * - * Generated from protobuf field .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. An output-only field indicating the state of the topic. - * - * Generated from protobuf field .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\Topic\State::class); - $this->state = $var; - - return $this; - } - - /** - * Optional. Settings for ingestion from a data source into this topic. - * - * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\PubSub\V1\IngestionDataSourceSettings|null - */ - public function getIngestionDataSourceSettings() - { - return $this->ingestion_data_source_settings; - } - - public function hasIngestionDataSourceSettings() - { - return isset($this->ingestion_data_source_settings); - } - - public function clearIngestionDataSourceSettings() - { - unset($this->ingestion_data_source_settings); - } - - /** - * Optional. Settings for ingestion from a data source into this topic. - * - * Generated from protobuf field .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\PubSub\V1\IngestionDataSourceSettings $var - * @return $this - */ - public function setIngestionDataSourceSettings($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\IngestionDataSourceSettings::class); - $this->ingestion_data_source_settings = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic/State.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic/State.php deleted file mode 100644 index ca6a253e6503..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/Topic/State.php +++ /dev/null @@ -1,66 +0,0 @@ -google.pubsub.v1.Topic.State - */ -class State -{ - /** - * Default value. This value is unused. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * The topic does not have any persistent errors. - * - * Generated from protobuf enum ACTIVE = 1; - */ - const ACTIVE = 1; - /** - * Ingestion from the data source has encountered a permanent error. - * See the more detailed error state in the corresponding ingestion - * source configuration. - * - * Generated from protobuf enum INGESTION_RESOURCE_ERROR = 2; - */ - const INGESTION_RESOURCE_ERROR = 2; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::ACTIVE => 'ACTIVE', - self::INGESTION_RESOURCE_ERROR => 'INGESTION_RESOURCE_ERROR', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\PubSub\V1\Topic_State::class); - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSnapshotRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSnapshotRequest.php deleted file mode 100644 index aa2378043b3f..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSnapshotRequest.php +++ /dev/null @@ -1,141 +0,0 @@ -google.pubsub.v1.UpdateSnapshotRequest - */ -class UpdateSnapshotRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The updated snapshot object. - * - * Generated from protobuf field .google.pubsub.v1.Snapshot snapshot = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $snapshot = null; - /** - * Required. Indicates which fields in the provided snapshot to update. - * Must be specified and non-empty. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $update_mask = null; - - /** - * @param \Google\Cloud\PubSub\V1\Snapshot $snapshot Required. The updated snapshot object. - * @param \Google\Protobuf\FieldMask $updateMask Required. Indicates which fields in the provided snapshot to update. - * Must be specified and non-empty. - * - * @return \Google\Cloud\PubSub\V1\UpdateSnapshotRequest - * - * @experimental - */ - public static function build(\Google\Cloud\PubSub\V1\Snapshot $snapshot, \Google\Protobuf\FieldMask $updateMask): self - { - return (new self()) - ->setSnapshot($snapshot) - ->setUpdateMask($updateMask); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\PubSub\V1\Snapshot $snapshot - * Required. The updated snapshot object. - * @type \Google\Protobuf\FieldMask $update_mask - * Required. Indicates which fields in the provided snapshot to update. - * Must be specified and non-empty. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The updated snapshot object. - * - * Generated from protobuf field .google.pubsub.v1.Snapshot snapshot = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\PubSub\V1\Snapshot|null - */ - public function getSnapshot() - { - return $this->snapshot; - } - - public function hasSnapshot() - { - return isset($this->snapshot); - } - - public function clearSnapshot() - { - unset($this->snapshot); - } - - /** - * Required. The updated snapshot object. - * - * Generated from protobuf field .google.pubsub.v1.Snapshot snapshot = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\PubSub\V1\Snapshot $var - * @return $this - */ - public function setSnapshot($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Snapshot::class); - $this->snapshot = $var; - - return $this; - } - - /** - * Required. Indicates which fields in the provided snapshot to update. - * Must be specified and non-empty. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\FieldMask|null - */ - public function getUpdateMask() - { - return $this->update_mask; - } - - public function hasUpdateMask() - { - return isset($this->update_mask); - } - - public function clearUpdateMask() - { - unset($this->update_mask); - } - - /** - * Required. Indicates which fields in the provided snapshot to update. - * Must be specified and non-empty. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setUpdateMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->update_mask = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSubscriptionRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSubscriptionRequest.php deleted file mode 100644 index d64008746353..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateSubscriptionRequest.php +++ /dev/null @@ -1,141 +0,0 @@ -google.pubsub.v1.UpdateSubscriptionRequest - */ -class UpdateSubscriptionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The updated subscription object. - * - * Generated from protobuf field .google.pubsub.v1.Subscription subscription = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $subscription = null; - /** - * Required. Indicates which fields in the provided subscription to update. - * Must be specified and non-empty. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $update_mask = null; - - /** - * @param \Google\Cloud\PubSub\V1\Subscription $subscription Required. The updated subscription object. - * @param \Google\Protobuf\FieldMask $updateMask Required. Indicates which fields in the provided subscription to update. - * Must be specified and non-empty. - * - * @return \Google\Cloud\PubSub\V1\UpdateSubscriptionRequest - * - * @experimental - */ - public static function build(\Google\Cloud\PubSub\V1\Subscription $subscription, \Google\Protobuf\FieldMask $updateMask): self - { - return (new self()) - ->setSubscription($subscription) - ->setUpdateMask($updateMask); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\PubSub\V1\Subscription $subscription - * Required. The updated subscription object. - * @type \Google\Protobuf\FieldMask $update_mask - * Required. Indicates which fields in the provided subscription to update. - * Must be specified and non-empty. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The updated subscription object. - * - * Generated from protobuf field .google.pubsub.v1.Subscription subscription = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\PubSub\V1\Subscription|null - */ - public function getSubscription() - { - return $this->subscription; - } - - public function hasSubscription() - { - return isset($this->subscription); - } - - public function clearSubscription() - { - unset($this->subscription); - } - - /** - * Required. The updated subscription object. - * - * Generated from protobuf field .google.pubsub.v1.Subscription subscription = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\PubSub\V1\Subscription $var - * @return $this - */ - public function setSubscription($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Subscription::class); - $this->subscription = $var; - - return $this; - } - - /** - * Required. Indicates which fields in the provided subscription to update. - * Must be specified and non-empty. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\FieldMask|null - */ - public function getUpdateMask() - { - return $this->update_mask; - } - - public function hasUpdateMask() - { - return isset($this->update_mask); - } - - public function clearUpdateMask() - { - unset($this->update_mask); - } - - /** - * Required. Indicates which fields in the provided subscription to update. - * Must be specified and non-empty. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setUpdateMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->update_mask = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateTopicRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateTopicRequest.php deleted file mode 100644 index 1a09ea4292aa..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/UpdateTopicRequest.php +++ /dev/null @@ -1,156 +0,0 @@ -google.pubsub.v1.UpdateTopicRequest - */ -class UpdateTopicRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The updated topic object. - * - * Generated from protobuf field .google.pubsub.v1.Topic topic = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $topic = null; - /** - * Required. Indicates which fields in the provided topic to update. Must be - * specified and non-empty. Note that if `update_mask` contains - * "message_storage_policy" but the `message_storage_policy` is not set in - * the `topic` provided above, then the updated value is determined by the - * policy configured at the project or organization level. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $update_mask = null; - - /** - * @param \Google\Cloud\PubSub\V1\Topic $topic Required. The updated topic object. - * @param \Google\Protobuf\FieldMask $updateMask Required. Indicates which fields in the provided topic to update. Must be - * specified and non-empty. Note that if `update_mask` contains - * "message_storage_policy" but the `message_storage_policy` is not set in - * the `topic` provided above, then the updated value is determined by the - * policy configured at the project or organization level. - * - * @return \Google\Cloud\PubSub\V1\UpdateTopicRequest - * - * @experimental - */ - public static function build(\Google\Cloud\PubSub\V1\Topic $topic, \Google\Protobuf\FieldMask $updateMask): self - { - return (new self()) - ->setTopic($topic) - ->setUpdateMask($updateMask); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\PubSub\V1\Topic $topic - * Required. The updated topic object. - * @type \Google\Protobuf\FieldMask $update_mask - * Required. Indicates which fields in the provided topic to update. Must be - * specified and non-empty. Note that if `update_mask` contains - * "message_storage_policy" but the `message_storage_policy` is not set in - * the `topic` provided above, then the updated value is determined by the - * policy configured at the project or organization level. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce(); - parent::__construct($data); - } - - /** - * Required. The updated topic object. - * - * Generated from protobuf field .google.pubsub.v1.Topic topic = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\PubSub\V1\Topic|null - */ - public function getTopic() - { - return $this->topic; - } - - public function hasTopic() - { - return isset($this->topic); - } - - public function clearTopic() - { - unset($this->topic); - } - - /** - * Required. The updated topic object. - * - * Generated from protobuf field .google.pubsub.v1.Topic topic = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\PubSub\V1\Topic $var - * @return $this - */ - public function setTopic($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Topic::class); - $this->topic = $var; - - return $this; - } - - /** - * Required. Indicates which fields in the provided topic to update. Must be - * specified and non-empty. Note that if `update_mask` contains - * "message_storage_policy" but the `message_storage_policy` is not set in - * the `topic` provided above, then the updated value is determined by the - * policy configured at the project or organization level. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\FieldMask|null - */ - public function getUpdateMask() - { - return $this->update_mask; - } - - public function hasUpdateMask() - { - return isset($this->update_mask); - } - - public function clearUpdateMask() - { - unset($this->update_mask); - } - - /** - * Required. Indicates which fields in the provided topic to update. Must be - * specified and non-empty. Note that if `update_mask` contains - * "message_storage_policy" but the `message_storage_policy` is not set in - * the `topic` provided above, then the updated value is determined by the - * policy configured at the project or organization level. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setUpdateMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->update_mask = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageRequest.php deleted file mode 100644 index cc85b3a7abd4..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageRequest.php +++ /dev/null @@ -1,217 +0,0 @@ -google.pubsub.v1.ValidateMessageRequest - */ -class ValidateMessageRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the project in which to validate schemas. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Message to validate against the provided `schema_spec`. - * - * Generated from protobuf field bytes message = 4; - */ - protected $message = ''; - /** - * The encoding expected for messages - * - * Generated from protobuf field .google.pubsub.v1.Encoding encoding = 5; - */ - protected $encoding = 0; - protected $schema_spec; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the project in which to validate schemas. - * Format is `projects/{project-id}`. - * @type string $name - * Name of the schema against which to validate. - * Format is `projects/{project}/schemas/{schema}`. - * @type \Google\Cloud\PubSub\V1\Schema $schema - * Ad-hoc schema against which to validate - * @type string $message - * Message to validate against the provided `schema_spec`. - * @type int $encoding - * The encoding expected for messages - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the project in which to validate schemas. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the project in which to validate schemas. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Name of the schema against which to validate. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 2 [(.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->readOneof(2); - } - - public function hasName() - { - return $this->hasOneof(2); - } - - /** - * Name of the schema against which to validate. - * Format is `projects/{project}/schemas/{schema}`. - * - * Generated from protobuf field string name = 2 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * Ad-hoc schema against which to validate - * - * Generated from protobuf field .google.pubsub.v1.Schema schema = 3; - * @return \Google\Cloud\PubSub\V1\Schema|null - */ - public function getSchema() - { - return $this->readOneof(3); - } - - public function hasSchema() - { - return $this->hasOneof(3); - } - - /** - * Ad-hoc schema against which to validate - * - * Generated from protobuf field .google.pubsub.v1.Schema schema = 3; - * @param \Google\Cloud\PubSub\V1\Schema $var - * @return $this - */ - public function setSchema($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Schema::class); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Message to validate against the provided `schema_spec`. - * - * Generated from protobuf field bytes message = 4; - * @return string - */ - public function getMessage() - { - return $this->message; - } - - /** - * Message to validate against the provided `schema_spec`. - * - * Generated from protobuf field bytes message = 4; - * @param string $var - * @return $this - */ - public function setMessage($var) - { - GPBUtil::checkString($var, False); - $this->message = $var; - - return $this; - } - - /** - * The encoding expected for messages - * - * Generated from protobuf field .google.pubsub.v1.Encoding encoding = 5; - * @return int - */ - public function getEncoding() - { - return $this->encoding; - } - - /** - * The encoding expected for messages - * - * Generated from protobuf field .google.pubsub.v1.Encoding encoding = 5; - * @param int $var - * @return $this - */ - public function setEncoding($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\PubSub\V1\Encoding::class); - $this->encoding = $var; - - return $this; - } - - /** - * @return string - */ - public function getSchemaSpec() - { - return $this->whichOneof("schema_spec"); - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageResponse.php deleted file mode 100644 index 3447bdcc8e1d..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateMessageResponse.php +++ /dev/null @@ -1,34 +0,0 @@ -google.pubsub.v1.ValidateMessageResponse - */ -class ValidateMessageResponse extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaRequest.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaRequest.php deleted file mode 100644 index 25fd4f172a70..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaRequest.php +++ /dev/null @@ -1,132 +0,0 @@ -google.pubsub.v1.ValidateSchemaRequest - */ -class ValidateSchemaRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the project in which to validate schemas. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. The schema object to validate. - * - * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $schema = null; - - /** - * @param string $parent Required. The name of the project in which to validate schemas. - * Format is `projects/{project-id}`. Please see - * {@see SchemaServiceClient::projectName()} for help formatting this field. - * @param \Google\Cloud\PubSub\V1\Schema $schema Required. The schema object to validate. - * - * @return \Google\Cloud\PubSub\V1\ValidateSchemaRequest - * - * @experimental - */ - public static function build(string $parent, \Google\Cloud\PubSub\V1\Schema $schema): self - { - return (new self()) - ->setParent($parent) - ->setSchema($schema); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the project in which to validate schemas. - * Format is `projects/{project-id}`. - * @type \Google\Cloud\PubSub\V1\Schema $schema - * Required. The schema object to validate. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the project in which to validate schemas. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the project in which to validate schemas. - * Format is `projects/{project-id}`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. The schema object to validate. - * - * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\PubSub\V1\Schema|null - */ - public function getSchema() - { - return $this->schema; - } - - public function hasSchema() - { - return isset($this->schema); - } - - public function clearSchema() - { - unset($this->schema); - } - - /** - * Required. The schema object to validate. - * - * Generated from protobuf field .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\PubSub\V1\Schema $var - * @return $this - */ - public function setSchema($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Schema::class); - $this->schema = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaResponse.php b/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaResponse.php deleted file mode 100644 index 777511b5f987..000000000000 --- a/owl-bot-staging/PubSub/v1/proto/src/Google/Cloud/PubSub/V1/ValidateSchemaResponse.php +++ /dev/null @@ -1,34 +0,0 @@ -google.pubsub.v1.ValidateSchemaResponse - */ -class ValidateSchemaResponse extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Pubsub\V1\Schema::initOnce(); - parent::__construct($data); - } - -} - diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/create_topic.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/create_topic.php deleted file mode 100644 index 316f4cb7a671..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/create_topic.php +++ /dev/null @@ -1,75 +0,0 @@ -setName($name); - - // Call the API and handle any network failures. - try { - /** @var Topic $response */ - $response = $publisherClient->createTopic($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $name = '[NAME]'; - - create_topic_sample($name); -} -// [END pubsub_v1_generated_Publisher_CreateTopic_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/delete_topic.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/delete_topic.php deleted file mode 100644 index 128ab5472a75..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/delete_topic.php +++ /dev/null @@ -1,74 +0,0 @@ -setTopic($formattedTopic); - - // Call the API and handle any network failures. - try { - $publisherClient->deleteTopic($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedTopic = PublisherClient::topicName('[PROJECT]', '[TOPIC]'); - - delete_topic_sample($formattedTopic); -} -// [END pubsub_v1_generated_Publisher_DeleteTopic_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/detach_subscription.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/detach_subscription.php deleted file mode 100644 index 4c1c766c4bce..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/detach_subscription.php +++ /dev/null @@ -1,75 +0,0 @@ -setSubscription($formattedSubscription); - - // Call the API and handle any network failures. - try { - /** @var DetachSubscriptionResponse $response */ - $response = $publisherClient->detachSubscription($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSubscription = PublisherClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - - detach_subscription_sample($formattedSubscription); -} -// [END pubsub_v1_generated_Publisher_DetachSubscription_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_iam_policy.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_iam_policy.php deleted file mode 100644 index 54e97ffbd1c7..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_iam_policy.php +++ /dev/null @@ -1,72 +0,0 @@ -setResource($resource); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $publisherClient->getIamPolicy($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - - get_iam_policy_sample($resource); -} -// [END pubsub_v1_generated_Publisher_GetIamPolicy_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_topic.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_topic.php deleted file mode 100644 index 5b08a9beef4c..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/get_topic.php +++ /dev/null @@ -1,72 +0,0 @@ -setTopic($formattedTopic); - - // Call the API and handle any network failures. - try { - /** @var Topic $response */ - $response = $publisherClient->getTopic($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedTopic = PublisherClient::topicName('[PROJECT]', '[TOPIC]'); - - get_topic_sample($formattedTopic); -} -// [END pubsub_v1_generated_Publisher_GetTopic_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_snapshots.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_snapshots.php deleted file mode 100644 index 640c0a2f75af..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_snapshots.php +++ /dev/null @@ -1,80 +0,0 @@ -setTopic($formattedTopic); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $publisherClient->listTopicSnapshots($request); - - /** @var string $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedTopic = PublisherClient::topicName('[PROJECT]', '[TOPIC]'); - - list_topic_snapshots_sample($formattedTopic); -} -// [END pubsub_v1_generated_Publisher_ListTopicSnapshots_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_subscriptions.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_subscriptions.php deleted file mode 100644 index 4c808e9a7ca8..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topic_subscriptions.php +++ /dev/null @@ -1,76 +0,0 @@ -setTopic($formattedTopic); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $publisherClient->listTopicSubscriptions($request); - - /** @var string $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedTopic = PublisherClient::topicName('[PROJECT]', '[TOPIC]'); - - list_topic_subscriptions_sample($formattedTopic); -} -// [END pubsub_v1_generated_Publisher_ListTopicSubscriptions_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topics.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topics.php deleted file mode 100644 index 84f7989720d5..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/list_topics.php +++ /dev/null @@ -1,77 +0,0 @@ -setProject($formattedProject); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $publisherClient->listTopics($request); - - /** @var Topic $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedProject = PublisherClient::projectName('[PROJECT]'); - - list_topics_sample($formattedProject); -} -// [END pubsub_v1_generated_Publisher_ListTopics_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/publish.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/publish.php deleted file mode 100644 index c58244cd9965..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/publish.php +++ /dev/null @@ -1,76 +0,0 @@ -setTopic($formattedTopic) - ->setMessages($messages); - - // Call the API and handle any network failures. - try { - /** @var PublishResponse $response */ - $response = $publisherClient->publish($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedTopic = PublisherClient::topicName('[PROJECT]', '[TOPIC]'); - - publish_sample($formattedTopic); -} -// [END pubsub_v1_generated_Publisher_Publish_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/set_iam_policy.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/set_iam_policy.php deleted file mode 100644 index a5dc7d4bf3e1..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/set_iam_policy.php +++ /dev/null @@ -1,77 +0,0 @@ -setResource($resource) - ->setPolicy($policy); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $publisherClient->setIamPolicy($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - - set_iam_policy_sample($resource); -} -// [END pubsub_v1_generated_Publisher_SetIamPolicy_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/test_iam_permissions.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/test_iam_permissions.php deleted file mode 100644 index 42eb4aacb66d..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/test_iam_permissions.php +++ /dev/null @@ -1,84 +0,0 @@ -setResource($resource) - ->setPermissions($permissions); - - // Call the API and handle any network failures. - try { - /** @var TestIamPermissionsResponse $response */ - $response = $publisherClient->testIamPermissions($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - $permissionsElement = '[PERMISSIONS]'; - - test_iam_permissions_sample($resource, $permissionsElement); -} -// [END pubsub_v1_generated_Publisher_TestIamPermissions_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/update_topic.php b/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/update_topic.php deleted file mode 100644 index 2685411cef6c..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/PublisherClient/update_topic.php +++ /dev/null @@ -1,81 +0,0 @@ -setName($topicName); - $updateMask = new FieldMask(); - $request = (new UpdateTopicRequest()) - ->setTopic($topic) - ->setUpdateMask($updateMask); - - // Call the API and handle any network failures. - try { - /** @var Topic $response */ - $response = $publisherClient->updateTopic($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $topicName = '[NAME]'; - - update_topic_sample($topicName); -} -// [END pubsub_v1_generated_Publisher_UpdateTopic_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/commit_schema.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/commit_schema.php deleted file mode 100644 index de8d6bd5fe4c..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/commit_schema.php +++ /dev/null @@ -1,78 +0,0 @@ -setName($schemaName); - $request = (new CommitSchemaRequest()) - ->setName($formattedName) - ->setSchema($schema); - - // Call the API and handle any network failures. - try { - /** @var Schema $response */ - $response = $schemaServiceClient->commitSchema($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = SchemaServiceClient::schemaName('[PROJECT]', '[SCHEMA]'); - $schemaName = '[NAME]'; - - commit_schema_sample($formattedName, $schemaName); -} -// [END pubsub_v1_generated_SchemaService_CommitSchema_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/create_schema.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/create_schema.php deleted file mode 100644 index 3daea89e0902..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/create_schema.php +++ /dev/null @@ -1,78 +0,0 @@ -setName($schemaName); - $request = (new CreateSchemaRequest()) - ->setParent($formattedParent) - ->setSchema($schema); - - // Call the API and handle any network failures. - try { - /** @var Schema $response */ - $response = $schemaServiceClient->createSchema($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = SchemaServiceClient::projectName('[PROJECT]'); - $schemaName = '[NAME]'; - - create_schema_sample($formattedParent, $schemaName); -} -// [END pubsub_v1_generated_SchemaService_CreateSchema_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema.php deleted file mode 100644 index 5ffc378dba80..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema.php +++ /dev/null @@ -1,70 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - $schemaServiceClient->deleteSchema($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = SchemaServiceClient::schemaName('[PROJECT]', '[SCHEMA]'); - - delete_schema_sample($formattedName); -} -// [END pubsub_v1_generated_SchemaService_DeleteSchema_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema_revision.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema_revision.php deleted file mode 100644 index 86c02a211275..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/delete_schema_revision.php +++ /dev/null @@ -1,79 +0,0 @@ -setName($formattedName) - ->setRevisionId($revisionId); - - // Call the API and handle any network failures. - try { - /** @var Schema $response */ - $response = $schemaServiceClient->deleteSchemaRevision($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = SchemaServiceClient::schemaName('[PROJECT]', '[SCHEMA]'); - $revisionId = '[REVISION_ID]'; - - delete_schema_revision_sample($formattedName, $revisionId); -} -// [END pubsub_v1_generated_SchemaService_DeleteSchemaRevision_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_iam_policy.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_iam_policy.php deleted file mode 100644 index 64bf89b99ec3..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_iam_policy.php +++ /dev/null @@ -1,72 +0,0 @@ -setResource($resource); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $schemaServiceClient->getIamPolicy($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - - get_iam_policy_sample($resource); -} -// [END pubsub_v1_generated_SchemaService_GetIamPolicy_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_schema.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_schema.php deleted file mode 100644 index bcff150482ee..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/get_schema.php +++ /dev/null @@ -1,72 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var Schema $response */ - $response = $schemaServiceClient->getSchema($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = SchemaServiceClient::schemaName('[PROJECT]', '[SCHEMA]'); - - get_schema_sample($formattedName); -} -// [END pubsub_v1_generated_SchemaService_GetSchema_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schema_revisions.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schema_revisions.php deleted file mode 100644 index f2c3c2eec7ed..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schema_revisions.php +++ /dev/null @@ -1,76 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $schemaServiceClient->listSchemaRevisions($request); - - /** @var Schema $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = SchemaServiceClient::schemaName('[PROJECT]', '[SCHEMA]'); - - list_schema_revisions_sample($formattedName); -} -// [END pubsub_v1_generated_SchemaService_ListSchemaRevisions_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schemas.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schemas.php deleted file mode 100644 index 530a62b93920..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/list_schemas.php +++ /dev/null @@ -1,77 +0,0 @@ -setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $schemaServiceClient->listSchemas($request); - - /** @var Schema $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = SchemaServiceClient::projectName('[PROJECT]'); - - list_schemas_sample($formattedParent); -} -// [END pubsub_v1_generated_SchemaService_ListSchemas_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/rollback_schema.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/rollback_schema.php deleted file mode 100644 index 7fb67a43d5c4..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/rollback_schema.php +++ /dev/null @@ -1,77 +0,0 @@ -setName($formattedName) - ->setRevisionId($revisionId); - - // Call the API and handle any network failures. - try { - /** @var Schema $response */ - $response = $schemaServiceClient->rollbackSchema($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = SchemaServiceClient::schemaName('[PROJECT]', '[SCHEMA]'); - $revisionId = '[REVISION_ID]'; - - rollback_schema_sample($formattedName, $revisionId); -} -// [END pubsub_v1_generated_SchemaService_RollbackSchema_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/set_iam_policy.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/set_iam_policy.php deleted file mode 100644 index 330633f3b164..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/set_iam_policy.php +++ /dev/null @@ -1,77 +0,0 @@ -setResource($resource) - ->setPolicy($policy); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $schemaServiceClient->setIamPolicy($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - - set_iam_policy_sample($resource); -} -// [END pubsub_v1_generated_SchemaService_SetIamPolicy_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/test_iam_permissions.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/test_iam_permissions.php deleted file mode 100644 index 6adbcab9c434..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/test_iam_permissions.php +++ /dev/null @@ -1,84 +0,0 @@ -setResource($resource) - ->setPermissions($permissions); - - // Call the API and handle any network failures. - try { - /** @var TestIamPermissionsResponse $response */ - $response = $schemaServiceClient->testIamPermissions($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - $permissionsElement = '[PERMISSIONS]'; - - test_iam_permissions_sample($resource, $permissionsElement); -} -// [END pubsub_v1_generated_SchemaService_TestIamPermissions_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_message.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_message.php deleted file mode 100644 index 276757f26738..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_message.php +++ /dev/null @@ -1,72 +0,0 @@ -setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var ValidateMessageResponse $response */ - $response = $schemaServiceClient->validateMessage($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = SchemaServiceClient::projectName('[PROJECT]'); - - validate_message_sample($formattedParent); -} -// [END pubsub_v1_generated_SchemaService_ValidateMessage_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_schema.php b/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_schema.php deleted file mode 100644 index fc186436fb96..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SchemaServiceClient/validate_schema.php +++ /dev/null @@ -1,79 +0,0 @@ -setName($schemaName); - $request = (new ValidateSchemaRequest()) - ->setParent($formattedParent) - ->setSchema($schema); - - // Call the API and handle any network failures. - try { - /** @var ValidateSchemaResponse $response */ - $response = $schemaServiceClient->validateSchema($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = SchemaServiceClient::projectName('[PROJECT]'); - $schemaName = '[NAME]'; - - validate_schema_sample($formattedParent, $schemaName); -} -// [END pubsub_v1_generated_SchemaService_ValidateSchema_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/acknowledge.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/acknowledge.php deleted file mode 100644 index c06acebd45c0..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/acknowledge.php +++ /dev/null @@ -1,82 +0,0 @@ -setSubscription($formattedSubscription) - ->setAckIds($ackIds); - - // Call the API and handle any network failures. - try { - $subscriberClient->acknowledge($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $ackIdsElement = '[ACK_IDS]'; - - acknowledge_sample($formattedSubscription, $ackIdsElement); -} -// [END pubsub_v1_generated_Subscriber_Acknowledge_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_snapshot.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_snapshot.php deleted file mode 100644 index 1616d96fe49d..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_snapshot.php +++ /dev/null @@ -1,103 +0,0 @@ -setName($formattedName) - ->setSubscription($formattedSubscription); - - // Call the API and handle any network failures. - try { - /** @var Snapshot $response */ - $response = $subscriberClient->createSnapshot($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = SubscriberClient::snapshotName('[PROJECT]', '[SNAPSHOT]'); - $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - - create_snapshot_sample($formattedName, $formattedSubscription); -} -// [END pubsub_v1_generated_Subscriber_CreateSnapshot_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_subscription.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_subscription.php deleted file mode 100644 index 3d740e589e8d..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/create_subscription.php +++ /dev/null @@ -1,90 +0,0 @@ -setName($name) - ->setTopic($formattedTopic); - - // Call the API and handle any network failures. - try { - /** @var Subscription $response */ - $response = $subscriberClient->createSubscription($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $name = '[NAME]'; - $formattedTopic = SubscriberClient::topicName('[PROJECT]', '[TOPIC]'); - - create_subscription_sample($name, $formattedTopic); -} -// [END pubsub_v1_generated_Subscriber_CreateSubscription_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_snapshot.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_snapshot.php deleted file mode 100644 index e76cd30d0f1e..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_snapshot.php +++ /dev/null @@ -1,78 +0,0 @@ -setSnapshot($formattedSnapshot); - - // Call the API and handle any network failures. - try { - $subscriberClient->deleteSnapshot($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSnapshot = SubscriberClient::snapshotName('[PROJECT]', '[SNAPSHOT]'); - - delete_snapshot_sample($formattedSnapshot); -} -// [END pubsub_v1_generated_Subscriber_DeleteSnapshot_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_subscription.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_subscription.php deleted file mode 100644 index 052c67f9c8b2..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/delete_subscription.php +++ /dev/null @@ -1,74 +0,0 @@ -setSubscription($formattedSubscription); - - // Call the API and handle any network failures. - try { - $subscriberClient->deleteSubscription($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - - delete_subscription_sample($formattedSubscription); -} -// [END pubsub_v1_generated_Subscriber_DeleteSubscription_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_iam_policy.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_iam_policy.php deleted file mode 100644 index 8e003f43b71b..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_iam_policy.php +++ /dev/null @@ -1,72 +0,0 @@ -setResource($resource); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $subscriberClient->getIamPolicy($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - - get_iam_policy_sample($resource); -} -// [END pubsub_v1_generated_Subscriber_GetIamPolicy_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_snapshot.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_snapshot.php deleted file mode 100644 index 8b2da513c2ba..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_snapshot.php +++ /dev/null @@ -1,76 +0,0 @@ -setSnapshot($formattedSnapshot); - - // Call the API and handle any network failures. - try { - /** @var Snapshot $response */ - $response = $subscriberClient->getSnapshot($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSnapshot = SubscriberClient::snapshotName('[PROJECT]', '[SNAPSHOT]'); - - get_snapshot_sample($formattedSnapshot); -} -// [END pubsub_v1_generated_Subscriber_GetSnapshot_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_subscription.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_subscription.php deleted file mode 100644 index 63d0dcfdf6a3..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/get_subscription.php +++ /dev/null @@ -1,72 +0,0 @@ -setSubscription($formattedSubscription); - - // Call the API and handle any network failures. - try { - /** @var Subscription $response */ - $response = $subscriberClient->getSubscription($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - - get_subscription_sample($formattedSubscription); -} -// [END pubsub_v1_generated_Subscriber_GetSubscription_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_snapshots.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_snapshots.php deleted file mode 100644 index 781a23c3e60a..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_snapshots.php +++ /dev/null @@ -1,81 +0,0 @@ -setProject($formattedProject); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $subscriberClient->listSnapshots($request); - - /** @var Snapshot $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedProject = SubscriberClient::projectName('[PROJECT]'); - - list_snapshots_sample($formattedProject); -} -// [END pubsub_v1_generated_Subscriber_ListSnapshots_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_subscriptions.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_subscriptions.php deleted file mode 100644 index 2ea97dfabe5e..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/list_subscriptions.php +++ /dev/null @@ -1,77 +0,0 @@ -setProject($formattedProject); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $subscriberClient->listSubscriptions($request); - - /** @var Subscription $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedProject = SubscriberClient::projectName('[PROJECT]'); - - list_subscriptions_sample($formattedProject); -} -// [END pubsub_v1_generated_Subscriber_ListSubscriptions_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_ack_deadline.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_ack_deadline.php deleted file mode 100644 index 531956b0e383..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_ack_deadline.php +++ /dev/null @@ -1,92 +0,0 @@ -setSubscription($formattedSubscription) - ->setAckIds($ackIds) - ->setAckDeadlineSeconds($ackDeadlineSeconds); - - // Call the API and handle any network failures. - try { - $subscriberClient->modifyAckDeadline($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $ackIdsElement = '[ACK_IDS]'; - $ackDeadlineSeconds = 0; - - modify_ack_deadline_sample($formattedSubscription, $ackIdsElement, $ackDeadlineSeconds); -} -// [END pubsub_v1_generated_Subscriber_ModifyAckDeadline_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_push_config.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_push_config.php deleted file mode 100644 index efaef2f965d6..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/modify_push_config.php +++ /dev/null @@ -1,78 +0,0 @@ -setSubscription($formattedSubscription) - ->setPushConfig($pushConfig); - - // Call the API and handle any network failures. - try { - $subscriberClient->modifyPushConfig($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - - modify_push_config_sample($formattedSubscription); -} -// [END pubsub_v1_generated_Subscriber_ModifyPushConfig_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/pull.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/pull.php deleted file mode 100644 index 36a57b63ff47..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/pull.php +++ /dev/null @@ -1,77 +0,0 @@ -setSubscription($formattedSubscription) - ->setMaxMessages($maxMessages); - - // Call the API and handle any network failures. - try { - /** @var PullResponse $response */ - $response = $subscriberClient->pull($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $maxMessages = 0; - - pull_sample($formattedSubscription, $maxMessages); -} -// [END pubsub_v1_generated_Subscriber_Pull_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/seek.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/seek.php deleted file mode 100644 index 0a17e35acc6c..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/seek.php +++ /dev/null @@ -1,77 +0,0 @@ -setSubscription($formattedSubscription); - - // Call the API and handle any network failures. - try { - /** @var SeekResponse $response */ - $response = $subscriberClient->seek($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - - seek_sample($formattedSubscription); -} -// [END pubsub_v1_generated_Subscriber_Seek_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/set_iam_policy.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/set_iam_policy.php deleted file mode 100644 index 2f60a915d175..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/set_iam_policy.php +++ /dev/null @@ -1,77 +0,0 @@ -setResource($resource) - ->setPolicy($policy); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $subscriberClient->setIamPolicy($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - - set_iam_policy_sample($resource); -} -// [END pubsub_v1_generated_Subscriber_SetIamPolicy_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/streaming_pull.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/streaming_pull.php deleted file mode 100644 index 1c4ebff6908c..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/streaming_pull.php +++ /dev/null @@ -1,92 +0,0 @@ -setSubscription($formattedSubscription) - ->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds); - - // Call the API and handle any network failures. - try { - /** @var BidiStream $stream */ - $stream = $subscriberClient->streamingPull(); - $stream->writeAll([$request,]); - - /** @var StreamingPullResponse $element */ - foreach ($stream->closeWriteAndReadAll() as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $streamAckDeadlineSeconds = 0; - - streaming_pull_sample($formattedSubscription, $streamAckDeadlineSeconds); -} -// [END pubsub_v1_generated_Subscriber_StreamingPull_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/test_iam_permissions.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/test_iam_permissions.php deleted file mode 100644 index 32207175dd09..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/test_iam_permissions.php +++ /dev/null @@ -1,84 +0,0 @@ -setResource($resource) - ->setPermissions($permissions); - - // Call the API and handle any network failures. - try { - /** @var TestIamPermissionsResponse $response */ - $response = $subscriberClient->testIamPermissions($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - $permissionsElement = '[PERMISSIONS]'; - - test_iam_permissions_sample($resource, $permissionsElement); -} -// [END pubsub_v1_generated_Subscriber_TestIamPermissions_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_snapshot.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_snapshot.php deleted file mode 100644 index bdd5bb3027dd..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_snapshot.php +++ /dev/null @@ -1,67 +0,0 @@ -setSnapshot($snapshot) - ->setUpdateMask($updateMask); - - // Call the API and handle any network failures. - try { - /** @var Snapshot $response */ - $response = $subscriberClient->updateSnapshot($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} -// [END pubsub_v1_generated_Subscriber_UpdateSnapshot_sync] diff --git a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_subscription.php b/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_subscription.php deleted file mode 100644 index e3eb7cee7f6a..000000000000 --- a/owl-bot-staging/PubSub/v1/samples/V1/SubscriberClient/update_subscription.php +++ /dev/null @@ -1,90 +0,0 @@ -setName($subscriptionName) - ->setTopic($formattedSubscriptionTopic); - $updateMask = new FieldMask(); - $request = (new UpdateSubscriptionRequest()) - ->setSubscription($subscription) - ->setUpdateMask($updateMask); - - // Call the API and handle any network failures. - try { - /** @var Subscription $response */ - $response = $subscriberClient->updateSubscription($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $subscriptionName = '[NAME]'; - $formattedSubscriptionTopic = SubscriberClient::topicName('[PROJECT]', '[TOPIC]'); - - update_subscription_sample($subscriptionName, $formattedSubscriptionTopic); -} -// [END pubsub_v1_generated_Subscriber_UpdateSubscription_sync] diff --git a/owl-bot-staging/PubSub/v1/src/V1/Client/PublisherClient.php b/owl-bot-staging/PubSub/v1/src/V1/Client/PublisherClient.php deleted file mode 100644 index 179d1ccd4abd..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/Client/PublisherClient.php +++ /dev/null @@ -1,656 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/publisher_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/publisher_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/publisher_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/publisher_rest_client_config.php', - ], - ], - ]; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * _deleted-topic_ resource. - * - * @return string The formatted _deleted-topic_ resource. - */ - public static function deletedTopicName(): string - { - return self::getPathTemplate('deletedTopic')->render([]); - } - - /** - * Formats a string containing the fully-qualified path to represent a project - * resource. - * - * @param string $project - * - * @return string The formatted project resource. - */ - public static function projectName(string $project): string - { - return self::getPathTemplate('project')->render([ - 'project' => $project, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_topic resource. - * - * @param string $project - * @param string $topic - * - * @return string The formatted project_topic resource. - */ - public static function projectTopicName(string $project, string $topic): string - { - return self::getPathTemplate('projectTopic')->render([ - 'project' => $project, - 'topic' => $topic, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a schema - * resource. - * - * @param string $project - * @param string $schema - * - * @return string The formatted schema resource. - */ - public static function schemaName(string $project, string $schema): string - { - return self::getPathTemplate('schema')->render([ - 'project' => $project, - 'schema' => $schema, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a subscription - * resource. - * - * @param string $project - * @param string $subscription - * - * @return string The formatted subscription resource. - */ - public static function subscriptionName(string $project, string $subscription): string - { - return self::getPathTemplate('subscription')->render([ - 'project' => $project, - 'subscription' => $subscription, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a topic - * resource. - * - * @param string $project - * @param string $topic - * - * @return string The formatted topic resource. - */ - public static function topicName(string $project, string $topic): string - { - return self::getPathTemplate('topic')->render([ - 'project' => $project, - 'topic' => $topic, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - deletedTopic: _deleted-topic_ - * - project: projects/{project} - * - projectTopic: projects/{project}/topics/{topic} - * - schema: projects/{project}/schemas/{schema} - * - subscription: projects/{project}/subscriptions/{subscription} - * - topic: projects/{project}/topics/{topic} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'pubsub.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Creates the given topic with the given name. See the [resource name rules] - * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). - * - * The async variant is {@see PublisherClient::createTopicAsync()} . - * - * @example samples/V1/PublisherClient/create_topic.php - * - * @param Topic $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Topic - * - * @throws ApiException Thrown if the API call fails. - */ - public function createTopic(Topic $request, array $callOptions = []): Topic - { - return $this->startApiCall('CreateTopic', $request, $callOptions)->wait(); - } - - /** - * 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_`. - * - * The async variant is {@see PublisherClient::deleteTopicAsync()} . - * - * @example samples/V1/PublisherClient/delete_topic.php - * - * @param DeleteTopicRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteTopic(DeleteTopicRequest $request, array $callOptions = []): void - { - $this->startApiCall('DeleteTopic', $request, $callOptions)->wait(); - } - - /** - * 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. - * - * The async variant is {@see PublisherClient::detachSubscriptionAsync()} . - * - * @example samples/V1/PublisherClient/detach_subscription.php - * - * @param DetachSubscriptionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return DetachSubscriptionResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function detachSubscription(DetachSubscriptionRequest $request, array $callOptions = []): DetachSubscriptionResponse - { - return $this->startApiCall('DetachSubscription', $request, $callOptions)->wait(); - } - - /** - * Gets the configuration of a topic. - * - * The async variant is {@see PublisherClient::getTopicAsync()} . - * - * @example samples/V1/PublisherClient/get_topic.php - * - * @param GetTopicRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Topic - * - * @throws ApiException Thrown if the API call fails. - */ - public function getTopic(GetTopicRequest $request, array $callOptions = []): Topic - { - return $this->startApiCall('GetTopic', $request, $callOptions)->wait(); - } - - /** - * Lists the names of the snapshots on this topic. Snapshots are used in - * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - * which allow you to manage message acknowledgments in bulk. That is, you can - * set the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * - * The async variant is {@see PublisherClient::listTopicSnapshotsAsync()} . - * - * @example samples/V1/PublisherClient/list_topic_snapshots.php - * - * @param ListTopicSnapshotsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listTopicSnapshots(ListTopicSnapshotsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListTopicSnapshots', $request, $callOptions); - } - - /** - * Lists the names of the attached subscriptions on this topic. - * - * The async variant is {@see PublisherClient::listTopicSubscriptionsAsync()} . - * - * @example samples/V1/PublisherClient/list_topic_subscriptions.php - * - * @param ListTopicSubscriptionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listTopicSubscriptions(ListTopicSubscriptionsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListTopicSubscriptions', $request, $callOptions); - } - - /** - * Lists matching topics. - * - * The async variant is {@see PublisherClient::listTopicsAsync()} . - * - * @example samples/V1/PublisherClient/list_topics.php - * - * @param ListTopicsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listTopics(ListTopicsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListTopics', $request, $callOptions); - } - - /** - * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic - * does not exist. - * - * The async variant is {@see PublisherClient::publishAsync()} . - * - * @example samples/V1/PublisherClient/publish.php - * - * @param PublishRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PublishResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function publish(PublishRequest $request, array $callOptions = []): PublishResponse - { - return $this->startApiCall('Publish', $request, $callOptions)->wait(); - } - - /** - * Updates an existing topic by updating the fields specified in the update - * mask. Note that certain properties of a topic are not modifiable. - * - * The async variant is {@see PublisherClient::updateTopicAsync()} . - * - * @example samples/V1/PublisherClient/update_topic.php - * - * @param UpdateTopicRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Topic - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateTopic(UpdateTopicRequest $request, array $callOptions = []): Topic - { - return $this->startApiCall('UpdateTopic', $request, $callOptions)->wait(); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * The async variant is {@see PublisherClient::getIamPolicyAsync()} . - * - * @example samples/V1/PublisherClient/get_iam_policy.php - * - * @param GetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * The async variant is {@see PublisherClient::setIamPolicyAsync()} . - * - * @example samples/V1/PublisherClient/set_iam_policy.php - * - * @param SetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * 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. - * - * The async variant is {@see PublisherClient::testIamPermissionsAsync()} . - * - * @example samples/V1/PublisherClient/test_iam_permissions.php - * - * @param TestIamPermissionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return TestIamPermissionsResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { - return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); - } -} diff --git a/owl-bot-staging/PubSub/v1/src/V1/Client/SchemaServiceClient.php b/owl-bot-staging/PubSub/v1/src/V1/Client/SchemaServiceClient.php deleted file mode 100644 index 5c320496d9cb..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/Client/SchemaServiceClient.php +++ /dev/null @@ -1,604 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/schema_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/schema_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/schema_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/schema_service_rest_client_config.php', - ], - ], - ]; - } - - /** - * Formats a string containing the fully-qualified path to represent a project - * resource. - * - * @param string $project - * - * @return string The formatted project resource. - */ - public static function projectName(string $project): string - { - return self::getPathTemplate('project')->render([ - 'project' => $project, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a schema - * resource. - * - * @param string $project - * @param string $schema - * - * @return string The formatted schema resource. - */ - public static function schemaName(string $project, string $schema): string - { - return self::getPathTemplate('schema')->render([ - 'project' => $project, - 'schema' => $schema, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - project: projects/{project} - * - schema: projects/{project}/schemas/{schema} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'pubsub.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Commits a new schema revision to an existing schema. - * - * The async variant is {@see SchemaServiceClient::commitSchemaAsync()} . - * - * @example samples/V1/SchemaServiceClient/commit_schema.php - * - * @param CommitSchemaRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Schema - * - * @throws ApiException Thrown if the API call fails. - */ - public function commitSchema(CommitSchemaRequest $request, array $callOptions = []): Schema - { - return $this->startApiCall('CommitSchema', $request, $callOptions)->wait(); - } - - /** - * Creates a schema. - * - * The async variant is {@see SchemaServiceClient::createSchemaAsync()} . - * - * @example samples/V1/SchemaServiceClient/create_schema.php - * - * @param CreateSchemaRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Schema - * - * @throws ApiException Thrown if the API call fails. - */ - public function createSchema(CreateSchemaRequest $request, array $callOptions = []): Schema - { - return $this->startApiCall('CreateSchema', $request, $callOptions)->wait(); - } - - /** - * Deletes a schema. - * - * The async variant is {@see SchemaServiceClient::deleteSchemaAsync()} . - * - * @example samples/V1/SchemaServiceClient/delete_schema.php - * - * @param DeleteSchemaRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteSchema(DeleteSchemaRequest $request, array $callOptions = []): void - { - $this->startApiCall('DeleteSchema', $request, $callOptions)->wait(); - } - - /** - * Deletes a specific schema revision. - * - * The async variant is {@see SchemaServiceClient::deleteSchemaRevisionAsync()} . - * - * @example samples/V1/SchemaServiceClient/delete_schema_revision.php - * - * @param DeleteSchemaRevisionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Schema - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteSchemaRevision(DeleteSchemaRevisionRequest $request, array $callOptions = []): Schema - { - return $this->startApiCall('DeleteSchemaRevision', $request, $callOptions)->wait(); - } - - /** - * Gets a schema. - * - * The async variant is {@see SchemaServiceClient::getSchemaAsync()} . - * - * @example samples/V1/SchemaServiceClient/get_schema.php - * - * @param GetSchemaRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Schema - * - * @throws ApiException Thrown if the API call fails. - */ - public function getSchema(GetSchemaRequest $request, array $callOptions = []): Schema - { - return $this->startApiCall('GetSchema', $request, $callOptions)->wait(); - } - - /** - * Lists all schema revisions for the named schema. - * - * The async variant is {@see SchemaServiceClient::listSchemaRevisionsAsync()} . - * - * @example samples/V1/SchemaServiceClient/list_schema_revisions.php - * - * @param ListSchemaRevisionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listSchemaRevisions(ListSchemaRevisionsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListSchemaRevisions', $request, $callOptions); - } - - /** - * Lists schemas in a project. - * - * The async variant is {@see SchemaServiceClient::listSchemasAsync()} . - * - * @example samples/V1/SchemaServiceClient/list_schemas.php - * - * @param ListSchemasRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listSchemas(ListSchemasRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListSchemas', $request, $callOptions); - } - - /** - * Creates a new schema revision that is a copy of the provided revision_id. - * - * The async variant is {@see SchemaServiceClient::rollbackSchemaAsync()} . - * - * @example samples/V1/SchemaServiceClient/rollback_schema.php - * - * @param RollbackSchemaRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Schema - * - * @throws ApiException Thrown if the API call fails. - */ - public function rollbackSchema(RollbackSchemaRequest $request, array $callOptions = []): Schema - { - return $this->startApiCall('RollbackSchema', $request, $callOptions)->wait(); - } - - /** - * Validates a message against a schema. - * - * The async variant is {@see SchemaServiceClient::validateMessageAsync()} . - * - * @example samples/V1/SchemaServiceClient/validate_message.php - * - * @param ValidateMessageRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return ValidateMessageResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function validateMessage(ValidateMessageRequest $request, array $callOptions = []): ValidateMessageResponse - { - return $this->startApiCall('ValidateMessage', $request, $callOptions)->wait(); - } - - /** - * Validates a schema. - * - * The async variant is {@see SchemaServiceClient::validateSchemaAsync()} . - * - * @example samples/V1/SchemaServiceClient/validate_schema.php - * - * @param ValidateSchemaRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return ValidateSchemaResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function validateSchema(ValidateSchemaRequest $request, array $callOptions = []): ValidateSchemaResponse - { - return $this->startApiCall('ValidateSchema', $request, $callOptions)->wait(); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * The async variant is {@see SchemaServiceClient::getIamPolicyAsync()} . - * - * @example samples/V1/SchemaServiceClient/get_iam_policy.php - * - * @param GetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * The async variant is {@see SchemaServiceClient::setIamPolicyAsync()} . - * - * @example samples/V1/SchemaServiceClient/set_iam_policy.php - * - * @param SetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * 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. - * - * The async variant is {@see SchemaServiceClient::testIamPermissionsAsync()} . - * - * @example samples/V1/SchemaServiceClient/test_iam_permissions.php - * - * @param TestIamPermissionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return TestIamPermissionsResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { - return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); - } -} diff --git a/owl-bot-staging/PubSub/v1/src/V1/Client/SubscriberClient.php b/owl-bot-staging/PubSub/v1/src/V1/Client/SubscriberClient.php deleted file mode 100644 index 97e628a8c42b..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/Client/SubscriberClient.php +++ /dev/null @@ -1,905 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/subscriber_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/subscriber_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/subscriber_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/subscriber_rest_client_config.php', - ], - ], - ]; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * _deleted-topic_ resource. - * - * @return string The formatted _deleted-topic_ resource. - */ - public static function deletedTopicName(): string - { - return self::getPathTemplate('deletedTopic')->render([]); - } - - /** - * Formats a string containing the fully-qualified path to represent a project - * resource. - * - * @param string $project - * - * @return string The formatted project resource. - */ - public static function projectName(string $project): string - { - return self::getPathTemplate('project')->render([ - 'project' => $project, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_topic resource. - * - * @param string $project - * @param string $topic - * - * @return string The formatted project_topic resource. - */ - public static function projectTopicName(string $project, string $topic): string - { - return self::getPathTemplate('projectTopic')->render([ - 'project' => $project, - 'topic' => $topic, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a snapshot - * resource. - * - * @param string $project - * @param string $snapshot - * - * @return string The formatted snapshot resource. - */ - public static function snapshotName(string $project, string $snapshot): string - { - return self::getPathTemplate('snapshot')->render([ - 'project' => $project, - 'snapshot' => $snapshot, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a subscription - * resource. - * - * @param string $project - * @param string $subscription - * - * @return string The formatted subscription resource. - */ - public static function subscriptionName(string $project, string $subscription): string - { - return self::getPathTemplate('subscription')->render([ - 'project' => $project, - 'subscription' => $subscription, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a topic - * resource. - * - * @param string $project - * @param string $topic - * - * @return string The formatted topic resource. - */ - public static function topicName(string $project, string $topic): string - { - return self::getPathTemplate('topic')->render([ - 'project' => $project, - 'topic' => $topic, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - deletedTopic: _deleted-topic_ - * - project: projects/{project} - * - projectTopic: projects/{project}/topics/{topic} - * - snapshot: projects/{project}/snapshots/{snapshot} - * - subscription: projects/{project}/subscriptions/{subscription} - * - topic: projects/{project}/topics/{topic} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'pubsub.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Acknowledges the messages associated with the `ack_ids` in the - * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages - * from the subscription. - * - * Acknowledging a message whose ack deadline has expired may succeed, - * but such a message may be redelivered later. Acknowledging a message more - * than once will not result in an error. - * - * The async variant is {@see SubscriberClient::acknowledgeAsync()} . - * - * @example samples/V1/SubscriberClient/acknowledge.php - * - * @param AcknowledgeRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function acknowledge(AcknowledgeRequest $request, array $callOptions = []): void - { - $this->startApiCall('Acknowledge', $request, $callOptions)->wait(); - } - - /** - * Creates a snapshot from the requested subscription. Snapshots are used in - * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - * which allow you to manage message acknowledgments in bulk. That is, you can - * set the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * If the snapshot already exists, returns `ALREADY_EXISTS`. - * If the requested subscription doesn't exist, returns `NOT_FOUND`. - * If the backlog in the subscription is too old -- and the resulting snapshot - * would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. - * See also the `Snapshot.expire_time` field. If the name is not provided in - * the request, the server will assign a random - * name for this snapshot on the same project as the subscription, conforming - * to the [resource name format] - * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The - * generated name is populated in the returned Snapshot object. Note that for - * REST API requests, you must specify a name in the request. - * - * The async variant is {@see SubscriberClient::createSnapshotAsync()} . - * - * @example samples/V1/SubscriberClient/create_snapshot.php - * - * @param CreateSnapshotRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Snapshot - * - * @throws ApiException Thrown if the API call fails. - */ - public function createSnapshot(CreateSnapshotRequest $request, array $callOptions = []): Snapshot - { - return $this->startApiCall('CreateSnapshot', $request, $callOptions)->wait(); - } - - /** - * Creates a subscription to a given topic. See the [resource name rules] - * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). - * If the subscription already exists, returns `ALREADY_EXISTS`. - * If the corresponding topic doesn't exist, returns `NOT_FOUND`. - * - * If the name is not provided in the request, the server will assign a random - * name for this subscription on the same project as the topic, conforming - * to the [resource name format] - * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The - * generated name is populated in the returned Subscription object. Note that - * for REST API requests, you must specify a name in the request. - * - * The async variant is {@see SubscriberClient::createSubscriptionAsync()} . - * - * @example samples/V1/SubscriberClient/create_subscription.php - * - * @param Subscription $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Subscription - * - * @throws ApiException Thrown if the API call fails. - */ - public function createSubscription(Subscription $request, array $callOptions = []): Subscription - { - return $this->startApiCall('CreateSubscription', $request, $callOptions)->wait(); - } - - /** - * Removes an existing snapshot. Snapshots are used in [Seek] - * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set - * the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * When the snapshot is deleted, all messages retained in the snapshot - * are immediately dropped. After a snapshot is deleted, a new one may be - * created with the same name, but the new one has no association with the old - * snapshot or its subscription, unless the same subscription is specified. - * - * The async variant is {@see SubscriberClient::deleteSnapshotAsync()} . - * - * @example samples/V1/SubscriberClient/delete_snapshot.php - * - * @param DeleteSnapshotRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteSnapshot(DeleteSnapshotRequest $request, array $callOptions = []): void - { - $this->startApiCall('DeleteSnapshot', $request, $callOptions)->wait(); - } - - /** - * Deletes an existing subscription. All messages retained in the subscription - * are immediately dropped. Calls to `Pull` after deletion will return - * `NOT_FOUND`. After a subscription is deleted, a new one may be created with - * the same name, but the new one has no association with the old - * subscription or its topic unless the same topic is specified. - * - * The async variant is {@see SubscriberClient::deleteSubscriptionAsync()} . - * - * @example samples/V1/SubscriberClient/delete_subscription.php - * - * @param DeleteSubscriptionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteSubscription(DeleteSubscriptionRequest $request, array $callOptions = []): void - { - $this->startApiCall('DeleteSubscription', $request, $callOptions)->wait(); - } - - /** - * Gets the configuration details of a snapshot. Snapshots are used in - * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - * which allow you to manage message acknowledgments in bulk. That is, you can - * set the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * - * The async variant is {@see SubscriberClient::getSnapshotAsync()} . - * - * @example samples/V1/SubscriberClient/get_snapshot.php - * - * @param GetSnapshotRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Snapshot - * - * @throws ApiException Thrown if the API call fails. - */ - public function getSnapshot(GetSnapshotRequest $request, array $callOptions = []): Snapshot - { - return $this->startApiCall('GetSnapshot', $request, $callOptions)->wait(); - } - - /** - * Gets the configuration details of a subscription. - * - * The async variant is {@see SubscriberClient::getSubscriptionAsync()} . - * - * @example samples/V1/SubscriberClient/get_subscription.php - * - * @param GetSubscriptionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Subscription - * - * @throws ApiException Thrown if the API call fails. - */ - public function getSubscription(GetSubscriptionRequest $request, array $callOptions = []): Subscription - { - return $this->startApiCall('GetSubscription', $request, $callOptions)->wait(); - } - - /** - * Lists the existing snapshots. Snapshots are used in [Seek]( - * https://cloud.google.com/pubsub/docs/replay-overview) operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set - * the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * - * The async variant is {@see SubscriberClient::listSnapshotsAsync()} . - * - * @example samples/V1/SubscriberClient/list_snapshots.php - * - * @param ListSnapshotsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listSnapshots(ListSnapshotsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListSnapshots', $request, $callOptions); - } - - /** - * Lists matching subscriptions. - * - * The async variant is {@see SubscriberClient::listSubscriptionsAsync()} . - * - * @example samples/V1/SubscriberClient/list_subscriptions.php - * - * @param ListSubscriptionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listSubscriptions(ListSubscriptionsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListSubscriptions', $request, $callOptions); - } - - /** - * Modifies the ack deadline for a specific message. This method is useful - * to indicate that more time is needed to process a message by the - * subscriber, or to make the message available for redelivery if the - * processing was interrupted. Note that this does not modify the - * subscription-level `ackDeadlineSeconds` used for subsequent messages. - * - * The async variant is {@see SubscriberClient::modifyAckDeadlineAsync()} . - * - * @example samples/V1/SubscriberClient/modify_ack_deadline.php - * - * @param ModifyAckDeadlineRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function modifyAckDeadline(ModifyAckDeadlineRequest $request, array $callOptions = []): void - { - $this->startApiCall('ModifyAckDeadline', $request, $callOptions)->wait(); - } - - /** - * Modifies the `PushConfig` for a specified subscription. - * - * This may be used to change a push subscription to a pull one (signified by - * an empty `PushConfig`) or vice versa, or change the endpoint URL and other - * attributes of a push subscription. Messages will accumulate for delivery - * continuously through the call regardless of changes to the `PushConfig`. - * - * The async variant is {@see SubscriberClient::modifyPushConfigAsync()} . - * - * @example samples/V1/SubscriberClient/modify_push_config.php - * - * @param ModifyPushConfigRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function modifyPushConfig(ModifyPushConfigRequest $request, array $callOptions = []): void - { - $this->startApiCall('ModifyPushConfig', $request, $callOptions)->wait(); - } - - /** - * Pulls messages from the server. - * - * The async variant is {@see SubscriberClient::pullAsync()} . - * - * @example samples/V1/SubscriberClient/pull.php - * - * @param PullRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PullResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function pull(PullRequest $request, array $callOptions = []): PullResponse - { - return $this->startApiCall('Pull', $request, $callOptions)->wait(); - } - - /** - * Seeks an existing subscription to a point in time or to a given snapshot, - * whichever is provided in the request. Snapshots are used in [Seek] - * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set - * the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. Note that both the subscription and the - * snapshot must be on the same topic. - * - * The async variant is {@see SubscriberClient::seekAsync()} . - * - * @example samples/V1/SubscriberClient/seek.php - * - * @param SeekRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return SeekResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function seek(SeekRequest $request, array $callOptions = []): SeekResponse - { - return $this->startApiCall('Seek', $request, $callOptions)->wait(); - } - - /** - * Establishes a stream with the server, which sends messages down to the - * client. The client streams acknowledgements and ack deadline modifications - * back to the server. The server will close the stream and return the status - * on any error. The server may close the stream with status `UNAVAILABLE` to - * reassign server-side resources, in which case, the client should - * re-establish the stream. Flow control can be achieved by configuring the - * underlying RPC channel. - * - * @example samples/V1/SubscriberClient/streaming_pull.php - * - * @param array $callOptions { - * Optional. - * - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return BidiStream - * - * @throws ApiException Thrown if the API call fails. - */ - public function streamingPull(array $callOptions = []): BidiStream - { - return $this->startApiCall('StreamingPull', null, $callOptions); - } - - /** - * Updates an existing snapshot by updating the fields specified in the update - * mask. Snapshots are used in - * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - * which allow you to manage message acknowledgments in bulk. That is, you can - * set the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * - * The async variant is {@see SubscriberClient::updateSnapshotAsync()} . - * - * @example samples/V1/SubscriberClient/update_snapshot.php - * - * @param UpdateSnapshotRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Snapshot - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateSnapshot(UpdateSnapshotRequest $request, array $callOptions = []): Snapshot - { - return $this->startApiCall('UpdateSnapshot', $request, $callOptions)->wait(); - } - - /** - * Updates an existing subscription by updating the fields specified in the - * update mask. Note that certain properties of a subscription, such as its - * topic, are not modifiable. - * - * The async variant is {@see SubscriberClient::updateSubscriptionAsync()} . - * - * @example samples/V1/SubscriberClient/update_subscription.php - * - * @param UpdateSubscriptionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Subscription - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateSubscription(UpdateSubscriptionRequest $request, array $callOptions = []): Subscription - { - return $this->startApiCall('UpdateSubscription', $request, $callOptions)->wait(); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * The async variant is {@see SubscriberClient::getIamPolicyAsync()} . - * - * @example samples/V1/SubscriberClient/get_iam_policy.php - * - * @param GetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * The async variant is {@see SubscriberClient::setIamPolicyAsync()} . - * - * @example samples/V1/SubscriberClient/set_iam_policy.php - * - * @param SetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * 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. - * - * The async variant is {@see SubscriberClient::testIamPermissionsAsync()} . - * - * @example samples/V1/SubscriberClient/test_iam_permissions.php - * - * @param TestIamPermissionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return TestIamPermissionsResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { - return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); - } -} diff --git a/owl-bot-staging/PubSub/v1/src/V1/Gapic/PublisherGapicClient.php b/owl-bot-staging/PubSub/v1/src/V1/Gapic/PublisherGapicClient.php deleted file mode 100644 index 51dde331c06d..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/Gapic/PublisherGapicClient.php +++ /dev/null @@ -1,1117 +0,0 @@ -createTopic($name); - * } finally { - * $publisherClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\PubSub\V1\Client\PublisherClient}. - */ -class PublisherGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.pubsub.v1.Publisher'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'pubsub.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'pubsub.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/pubsub', - ]; - - private static $deletedTopicNameTemplate; - - private static $projectNameTemplate; - - private static $projectTopicNameTemplate; - - private static $schemaNameTemplate; - - private static $subscriptionNameTemplate; - - private static $topicNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/publisher_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/publisher_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/publisher_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/publisher_rest_client_config.php', - ], - ], - ]; - } - - private static function getDeletedTopicNameTemplate() - { - if (self::$deletedTopicNameTemplate == null) { - self::$deletedTopicNameTemplate = new PathTemplate('_deleted-topic_'); - } - - return self::$deletedTopicNameTemplate; - } - - private static function getProjectNameTemplate() - { - if (self::$projectNameTemplate == null) { - self::$projectNameTemplate = new PathTemplate('projects/{project}'); - } - - return self::$projectNameTemplate; - } - - private static function getProjectTopicNameTemplate() - { - if (self::$projectTopicNameTemplate == null) { - self::$projectTopicNameTemplate = new PathTemplate('projects/{project}/topics/{topic}'); - } - - return self::$projectTopicNameTemplate; - } - - private static function getSchemaNameTemplate() - { - if (self::$schemaNameTemplate == null) { - self::$schemaNameTemplate = new PathTemplate('projects/{project}/schemas/{schema}'); - } - - return self::$schemaNameTemplate; - } - - private static function getSubscriptionNameTemplate() - { - if (self::$subscriptionNameTemplate == null) { - self::$subscriptionNameTemplate = new PathTemplate('projects/{project}/subscriptions/{subscription}'); - } - - return self::$subscriptionNameTemplate; - } - - private static function getTopicNameTemplate() - { - if (self::$topicNameTemplate == null) { - self::$topicNameTemplate = new PathTemplate('projects/{project}/topics/{topic}'); - } - - return self::$topicNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'deletedTopic' => self::getDeletedTopicNameTemplate(), - 'project' => self::getProjectNameTemplate(), - 'projectTopic' => self::getProjectTopicNameTemplate(), - 'schema' => self::getSchemaNameTemplate(), - 'subscription' => self::getSubscriptionNameTemplate(), - 'topic' => self::getTopicNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * _deleted-topic_ resource. - * - * @return string The formatted _deleted-topic_ resource. - */ - public static function deletedTopicName() - { - return self::getDeletedTopicNameTemplate()->render([]); - } - - /** - * Formats a string containing the fully-qualified path to represent a project - * resource. - * - * @param string $project - * - * @return string The formatted project resource. - */ - public static function projectName($project) - { - return self::getProjectNameTemplate()->render([ - 'project' => $project, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_topic resource. - * - * @param string $project - * @param string $topic - * - * @return string The formatted project_topic resource. - */ - public static function projectTopicName($project, $topic) - { - return self::getProjectTopicNameTemplate()->render([ - 'project' => $project, - 'topic' => $topic, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a schema - * resource. - * - * @param string $project - * @param string $schema - * - * @return string The formatted schema resource. - */ - public static function schemaName($project, $schema) - { - return self::getSchemaNameTemplate()->render([ - 'project' => $project, - 'schema' => $schema, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a subscription - * resource. - * - * @param string $project - * @param string $subscription - * - * @return string The formatted subscription resource. - */ - public static function subscriptionName($project, $subscription) - { - return self::getSubscriptionNameTemplate()->render([ - 'project' => $project, - 'subscription' => $subscription, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a topic - * resource. - * - * @param string $project - * @param string $topic - * - * @return string The formatted topic resource. - */ - public static function topicName($project, $topic) - { - return self::getTopicNameTemplate()->render([ - 'project' => $project, - 'topic' => $topic, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - deletedTopic: _deleted-topic_ - * - project: projects/{project} - * - projectTopic: projects/{project}/topics/{topic} - * - schema: projects/{project}/schemas/{schema} - * - subscription: projects/{project}/subscriptions/{subscription} - * - topic: projects/{project}/topics/{topic} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'pubsub.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Creates the given topic with the given name. See the [resource name rules] - * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). - * - * Sample code: - * ``` - * $publisherClient = new PublisherClient(); - * try { - * $name = 'name'; - * $response = $publisherClient->createTopic($name); - * } finally { - * $publisherClient->close(); - * } - * ``` - * - * @param 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"`. - * @param array $optionalArgs { - * Optional. - * - * @type array $labels - * Optional. See [Creating and managing labels] - * (https://cloud.google.com/pubsub/docs/labels). - * @type MessageStoragePolicy $messageStoragePolicy - * Optional. Policy constraining the set of Google Cloud Platform regions - * where messages published to the topic may be stored. If not present, then - * no constraints are in effect. - * @type string $kmsKeyName - * Optional. The resource name of the Cloud KMS CryptoKey to be used to - * protect access to messages published on this topic. - * - * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - * @type SchemaSettings $schemaSettings - * Optional. Settings for validating messages published against a schema. - * @type bool $satisfiesPzs - * Optional. Reserved for future use. This field is set only in responses from - * the server; it is ignored if it is set in any requests. - * @type Duration $messageRetentionDuration - * Optional. Indicates the minimum duration to retain a message after it is - * published to the topic. If this field is set, messages published to the - * topic in the last `message_retention_duration` are always available to - * subscribers. For instance, it allows any attached subscription to [seek to - * a - * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) - * that is up to `message_retention_duration` in the past. If this field is - * not set, message retention is controlled by settings on individual - * subscriptions. Cannot be more than 31 days or less than 10 minutes. - * @type int $state - * Output only. An output-only field indicating the state of the topic. - * For allowed values, use constants defined on {@see \Google\Cloud\PubSub\V1\Topic\State} - * @type IngestionDataSourceSettings $ingestionDataSourceSettings - * Optional. Settings for ingestion from a data source into this topic. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Topic - * - * @throws ApiException if the remote call fails - */ - public function createTopic($name, array $optionalArgs = []) - { - $request = new Topic(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['labels'])) { - $request->setLabels($optionalArgs['labels']); - } - - if (isset($optionalArgs['messageStoragePolicy'])) { - $request->setMessageStoragePolicy($optionalArgs['messageStoragePolicy']); - } - - if (isset($optionalArgs['kmsKeyName'])) { - $request->setKmsKeyName($optionalArgs['kmsKeyName']); - } - - if (isset($optionalArgs['schemaSettings'])) { - $request->setSchemaSettings($optionalArgs['schemaSettings']); - } - - if (isset($optionalArgs['satisfiesPzs'])) { - $request->setSatisfiesPzs($optionalArgs['satisfiesPzs']); - } - - if (isset($optionalArgs['messageRetentionDuration'])) { - $request->setMessageRetentionDuration($optionalArgs['messageRetentionDuration']); - } - - if (isset($optionalArgs['state'])) { - $request->setState($optionalArgs['state']); - } - - if (isset($optionalArgs['ingestionDataSourceSettings'])) { - $request->setIngestionDataSourceSettings($optionalArgs['ingestionDataSourceSettings']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CreateTopic', Topic::class, $optionalArgs, $request)->wait(); - } - - /** - * 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_`. - * - * Sample code: - * ``` - * $publisherClient = new PublisherClient(); - * try { - * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); - * $publisherClient->deleteTopic($formattedTopic); - * } finally { - * $publisherClient->close(); - * } - * ``` - * - * @param string $topic Required. Name of the topic to delete. - * Format is `projects/{project}/topics/{topic}`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteTopic($topic, array $optionalArgs = []) - { - $request = new DeleteTopicRequest(); - $requestParamHeaders = []; - $request->setTopic($topic); - $requestParamHeaders['topic'] = $topic; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteTopic', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * 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. - * - * Sample code: - * ``` - * $publisherClient = new PublisherClient(); - * try { - * $formattedSubscription = $publisherClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - * $response = $publisherClient->detachSubscription($formattedSubscription); - * } finally { - * $publisherClient->close(); - * } - * ``` - * - * @param string $subscription Required. The subscription to detach. - * Format is `projects/{project}/subscriptions/{subscription}`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\DetachSubscriptionResponse - * - * @throws ApiException if the remote call fails - */ - public function detachSubscription($subscription, array $optionalArgs = []) - { - $request = new DetachSubscriptionRequest(); - $requestParamHeaders = []; - $request->setSubscription($subscription); - $requestParamHeaders['subscription'] = $subscription; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DetachSubscription', DetachSubscriptionResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the configuration of a topic. - * - * Sample code: - * ``` - * $publisherClient = new PublisherClient(); - * try { - * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); - * $response = $publisherClient->getTopic($formattedTopic); - * } finally { - * $publisherClient->close(); - * } - * ``` - * - * @param string $topic Required. The name of the topic to get. - * Format is `projects/{project}/topics/{topic}`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Topic - * - * @throws ApiException if the remote call fails - */ - public function getTopic($topic, array $optionalArgs = []) - { - $request = new GetTopicRequest(); - $requestParamHeaders = []; - $request->setTopic($topic); - $requestParamHeaders['topic'] = $topic; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetTopic', Topic::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists the names of the snapshots on this topic. Snapshots are used in - * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - * which allow you to manage message acknowledgments in bulk. That is, you can - * set the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * - * Sample code: - * ``` - * $publisherClient = new PublisherClient(); - * try { - * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); - * // Iterate over pages of elements - * $pagedResponse = $publisherClient->listTopicSnapshots($formattedTopic); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $publisherClient->listTopicSnapshots($formattedTopic); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $publisherClient->close(); - * } - * ``` - * - * @param string $topic Required. The name of the topic that snapshots are attached to. - * Format is `projects/{project}/topics/{topic}`. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listTopicSnapshots($topic, array $optionalArgs = []) - { - $request = new ListTopicSnapshotsRequest(); - $requestParamHeaders = []; - $request->setTopic($topic); - $requestParamHeaders['topic'] = $topic; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListTopicSnapshots', $optionalArgs, ListTopicSnapshotsResponse::class, $request); - } - - /** - * Lists the names of the attached subscriptions on this topic. - * - * Sample code: - * ``` - * $publisherClient = new PublisherClient(); - * try { - * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); - * // Iterate over pages of elements - * $pagedResponse = $publisherClient->listTopicSubscriptions($formattedTopic); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $publisherClient->listTopicSubscriptions($formattedTopic); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $publisherClient->close(); - * } - * ``` - * - * @param string $topic Required. The name of the topic that subscriptions are attached to. - * Format is `projects/{project}/topics/{topic}`. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listTopicSubscriptions($topic, array $optionalArgs = []) - { - $request = new ListTopicSubscriptionsRequest(); - $requestParamHeaders = []; - $request->setTopic($topic); - $requestParamHeaders['topic'] = $topic; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListTopicSubscriptions', $optionalArgs, ListTopicSubscriptionsResponse::class, $request); - } - - /** - * Lists matching topics. - * - * Sample code: - * ``` - * $publisherClient = new PublisherClient(); - * try { - * $formattedProject = $publisherClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $publisherClient->listTopics($formattedProject); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $publisherClient->listTopics($formattedProject); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $publisherClient->close(); - * } - * ``` - * - * @param string $project Required. The name of the project in which to list topics. - * Format is `projects/{project-id}`. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listTopics($project, array $optionalArgs = []) - { - $request = new ListTopicsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListTopics', $optionalArgs, ListTopicsResponse::class, $request); - } - - /** - * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic - * does not exist. - * - * Sample code: - * ``` - * $publisherClient = new PublisherClient(); - * try { - * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); - * $messages = []; - * $response = $publisherClient->publish($formattedTopic, $messages); - * } finally { - * $publisherClient->close(); - * } - * ``` - * - * @param string $topic Required. The messages in the request will be published on this topic. - * Format is `projects/{project}/topics/{topic}`. - * @param PubsubMessage[] $messages Required. The messages to publish. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\PublishResponse - * - * @throws ApiException if the remote call fails - */ - public function publish($topic, $messages, array $optionalArgs = []) - { - $request = new PublishRequest(); - $requestParamHeaders = []; - $request->setTopic($topic); - $request->setMessages($messages); - $requestParamHeaders['topic'] = $topic; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Publish', PublishResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates an existing topic by updating the fields specified in the update - * mask. Note that certain properties of a topic are not modifiable. - * - * Sample code: - * ``` - * $publisherClient = new PublisherClient(); - * try { - * $topic = new Topic(); - * $updateMask = new FieldMask(); - * $response = $publisherClient->updateTopic($topic, $updateMask); - * } finally { - * $publisherClient->close(); - * } - * ``` - * - * @param Topic $topic Required. The updated topic object. - * @param FieldMask $updateMask Required. Indicates which fields in the provided topic to update. Must be - * specified and non-empty. Note that if `update_mask` contains - * "message_storage_policy" but the `message_storage_policy` is not set in - * the `topic` provided above, then the updated value is determined by the - * policy configured at the project or organization level. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Topic - * - * @throws ApiException if the remote call fails - */ - public function updateTopic($topic, $updateMask, array $optionalArgs = []) - { - $request = new UpdateTopicRequest(); - $requestParamHeaders = []; - $request->setTopic($topic); - $request->setUpdateMask($updateMask); - $requestParamHeaders['topic.name'] = $topic->getName(); - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('UpdateTopic', Topic::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $publisherClient = new PublisherClient(); - * try { - * $resource = 'resource'; - * $response = $publisherClient->getIamPolicy($resource); - * } finally { - * $publisherClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $publisherClient = new PublisherClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $publisherClient->setIamPolicy($resource, $policy); - * } finally { - * $publisherClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); - } - - /** - * 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. - * - * Sample code: - * ``` - * $publisherClient = new PublisherClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $publisherClient->testIamPermissions($resource, $permissions); - * } finally { - * $publisherClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($resource, $permissions, array $optionalArgs = []) - { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); - } -} diff --git a/owl-bot-staging/PubSub/v1/src/V1/Gapic/SchemaServiceGapicClient.php b/owl-bot-staging/PubSub/v1/src/V1/Gapic/SchemaServiceGapicClient.php deleted file mode 100644 index 496f7d0174ad..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/Gapic/SchemaServiceGapicClient.php +++ /dev/null @@ -1,1006 +0,0 @@ -schemaName('[PROJECT]', '[SCHEMA]'); - * $schema = new Schema(); - * $response = $schemaServiceClient->commitSchema($formattedName, $schema); - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\PubSub\V1\Client\SchemaServiceClient}. - */ -class SchemaServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.pubsub.v1.SchemaService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'pubsub.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'pubsub.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/pubsub', - ]; - - private static $projectNameTemplate; - - private static $schemaNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/schema_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/schema_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/schema_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/schema_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getProjectNameTemplate() - { - if (self::$projectNameTemplate == null) { - self::$projectNameTemplate = new PathTemplate('projects/{project}'); - } - - return self::$projectNameTemplate; - } - - private static function getSchemaNameTemplate() - { - if (self::$schemaNameTemplate == null) { - self::$schemaNameTemplate = new PathTemplate('projects/{project}/schemas/{schema}'); - } - - return self::$schemaNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'project' => self::getProjectNameTemplate(), - 'schema' => self::getSchemaNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a project - * resource. - * - * @param string $project - * - * @return string The formatted project resource. - */ - public static function projectName($project) - { - return self::getProjectNameTemplate()->render([ - 'project' => $project, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a schema - * resource. - * - * @param string $project - * @param string $schema - * - * @return string The formatted schema resource. - */ - public static function schemaName($project, $schema) - { - return self::getSchemaNameTemplate()->render([ - 'project' => $project, - 'schema' => $schema, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - project: projects/{project} - * - schema: projects/{project}/schemas/{schema} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'pubsub.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Commits a new schema revision to an existing schema. - * - * Sample code: - * ``` - * $schemaServiceClient = new SchemaServiceClient(); - * try { - * $formattedName = $schemaServiceClient->schemaName('[PROJECT]', '[SCHEMA]'); - * $schema = new Schema(); - * $response = $schemaServiceClient->commitSchema($formattedName, $schema); - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the schema we are revising. - * Format is `projects/{project}/schemas/{schema}`. - * @param Schema $schema Required. The schema revision to commit. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Schema - * - * @throws ApiException if the remote call fails - */ - public function commitSchema($name, $schema, array $optionalArgs = []) - { - $request = new CommitSchemaRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setSchema($schema); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CommitSchema', Schema::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a schema. - * - * Sample code: - * ``` - * $schemaServiceClient = new SchemaServiceClient(); - * try { - * $formattedParent = $schemaServiceClient->projectName('[PROJECT]'); - * $schema = new Schema(); - * $response = $schemaServiceClient->createSchema($formattedParent, $schema); - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the project in which to create the schema. - * Format is `projects/{project-id}`. - * @param Schema $schema Required. The schema object to create. - * - * This schema's `name` parameter is ignored. The schema object returned - * by CreateSchema will have a `name` made using the given `parent` and - * `schema_id`. - * @param array $optionalArgs { - * Optional. - * - * @type string $schemaId - * The ID to use for the schema, which will become the final component of - * the schema's resource name. - * - * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for - * resource name constraints. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Schema - * - * @throws ApiException if the remote call fails - */ - public function createSchema($parent, $schema, array $optionalArgs = []) - { - $request = new CreateSchemaRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setSchema($schema); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['schemaId'])) { - $request->setSchemaId($optionalArgs['schemaId']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CreateSchema', Schema::class, $optionalArgs, $request)->wait(); - } - - /** - * Deletes a schema. - * - * Sample code: - * ``` - * $schemaServiceClient = new SchemaServiceClient(); - * try { - * $formattedName = $schemaServiceClient->schemaName('[PROJECT]', '[SCHEMA]'); - * $schemaServiceClient->deleteSchema($formattedName); - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the schema to delete. - * Format is `projects/{project}/schemas/{schema}`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteSchema($name, array $optionalArgs = []) - { - $request = new DeleteSchemaRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteSchema', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Deletes a specific schema revision. - * - * Sample code: - * ``` - * $schemaServiceClient = new SchemaServiceClient(); - * try { - * $formattedName = $schemaServiceClient->schemaName('[PROJECT]', '[SCHEMA]'); - * $revisionId = 'revision_id'; - * $response = $schemaServiceClient->deleteSchemaRevision($formattedName, $revisionId); - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the schema revision to be deleted, with a revision ID - * explicitly included. - * - * Example: `projects/123/schemas/my-schema@c7cfa2a8` - * @param string $revisionId Optional. This field is deprecated and should not be used for specifying - * the revision ID. The revision ID should be specified via the `name` - * parameter. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Schema - * - * @throws ApiException if the remote call fails - */ - public function deleteSchemaRevision($name, $revisionId, array $optionalArgs = []) - { - $request = new DeleteSchemaRevisionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setRevisionId($revisionId); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteSchemaRevision', Schema::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets a schema. - * - * Sample code: - * ``` - * $schemaServiceClient = new SchemaServiceClient(); - * try { - * $formattedName = $schemaServiceClient->schemaName('[PROJECT]', '[SCHEMA]'); - * $response = $schemaServiceClient->getSchema($formattedName); - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the schema to get. - * Format is `projects/{project}/schemas/{schema}`. - * @param array $optionalArgs { - * Optional. - * - * @type int $view - * The set of fields to return in the response. If not set, returns a Schema - * with all fields filled out. Set to `BASIC` to omit the `definition`. - * For allowed values, use constants defined on {@see \Google\Cloud\PubSub\V1\SchemaView} - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Schema - * - * @throws ApiException if the remote call fails - */ - public function getSchema($name, array $optionalArgs = []) - { - $request = new GetSchemaRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['view'])) { - $request->setView($optionalArgs['view']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetSchema', Schema::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists all schema revisions for the named schema. - * - * Sample code: - * ``` - * $schemaServiceClient = new SchemaServiceClient(); - * try { - * $formattedName = $schemaServiceClient->schemaName('[PROJECT]', '[SCHEMA]'); - * // Iterate over pages of elements - * $pagedResponse = $schemaServiceClient->listSchemaRevisions($formattedName); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $schemaServiceClient->listSchemaRevisions($formattedName); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the schema to list revisions for. - * @param array $optionalArgs { - * Optional. - * - * @type int $view - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * For allowed values, use constants defined on {@see \Google\Cloud\PubSub\V1\SchemaView} - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listSchemaRevisions($name, array $optionalArgs = []) - { - $request = new ListSchemaRevisionsRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['view'])) { - $request->setView($optionalArgs['view']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListSchemaRevisions', $optionalArgs, ListSchemaRevisionsResponse::class, $request); - } - - /** - * Lists schemas in a project. - * - * Sample code: - * ``` - * $schemaServiceClient = new SchemaServiceClient(); - * try { - * $formattedParent = $schemaServiceClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $schemaServiceClient->listSchemas($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $schemaServiceClient->listSchemas($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the project in which to list schemas. - * Format is `projects/{project-id}`. - * @param array $optionalArgs { - * Optional. - * - * @type int $view - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * For allowed values, use constants defined on {@see \Google\Cloud\PubSub\V1\SchemaView} - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listSchemas($parent, array $optionalArgs = []) - { - $request = new ListSchemasRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['view'])) { - $request->setView($optionalArgs['view']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListSchemas', $optionalArgs, ListSchemasResponse::class, $request); - } - - /** - * Creates a new schema revision that is a copy of the provided revision_id. - * - * Sample code: - * ``` - * $schemaServiceClient = new SchemaServiceClient(); - * try { - * $formattedName = $schemaServiceClient->schemaName('[PROJECT]', '[SCHEMA]'); - * $revisionId = 'revision_id'; - * $response = $schemaServiceClient->rollbackSchema($formattedName, $revisionId); - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The schema being rolled back with revision id. - * @param string $revisionId Required. The revision ID to roll back to. - * It must be a revision of the same schema. - * - * Example: c7cfa2a8 - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Schema - * - * @throws ApiException if the remote call fails - */ - public function rollbackSchema($name, $revisionId, array $optionalArgs = []) - { - $request = new RollbackSchemaRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setRevisionId($revisionId); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('RollbackSchema', Schema::class, $optionalArgs, $request)->wait(); - } - - /** - * Validates a message against a schema. - * - * Sample code: - * ``` - * $schemaServiceClient = new SchemaServiceClient(); - * try { - * $formattedParent = $schemaServiceClient->projectName('[PROJECT]'); - * $response = $schemaServiceClient->validateMessage($formattedParent); - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the project in which to validate schemas. - * Format is `projects/{project-id}`. - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Name of the schema against which to validate. - * - * Format is `projects/{project}/schemas/{schema}`. - * @type Schema $schema - * Ad-hoc schema against which to validate - * @type string $message - * Message to validate against the provided `schema_spec`. - * @type int $encoding - * The encoding expected for messages - * For allowed values, use constants defined on {@see \Google\Cloud\PubSub\V1\Encoding} - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\ValidateMessageResponse - * - * @throws ApiException if the remote call fails - */ - public function validateMessage($parent, array $optionalArgs = []) - { - $request = new ValidateMessageRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - } - - if (isset($optionalArgs['schema'])) { - $request->setSchema($optionalArgs['schema']); - } - - if (isset($optionalArgs['message'])) { - $request->setMessage($optionalArgs['message']); - } - - if (isset($optionalArgs['encoding'])) { - $request->setEncoding($optionalArgs['encoding']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ValidateMessage', ValidateMessageResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Validates a schema. - * - * Sample code: - * ``` - * $schemaServiceClient = new SchemaServiceClient(); - * try { - * $formattedParent = $schemaServiceClient->projectName('[PROJECT]'); - * $schema = new Schema(); - * $response = $schemaServiceClient->validateSchema($formattedParent, $schema); - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the project in which to validate schemas. - * Format is `projects/{project-id}`. - * @param Schema $schema Required. The schema object to validate. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\ValidateSchemaResponse - * - * @throws ApiException if the remote call fails - */ - public function validateSchema($parent, $schema, array $optionalArgs = []) - { - $request = new ValidateSchemaRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setSchema($schema); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ValidateSchema', ValidateSchemaResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $schemaServiceClient = new SchemaServiceClient(); - * try { - * $resource = 'resource'; - * $response = $schemaServiceClient->getIamPolicy($resource); - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $schemaServiceClient = new SchemaServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $schemaServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); - } - - /** - * 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. - * - * Sample code: - * ``` - * $schemaServiceClient = new SchemaServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $schemaServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $schemaServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($resource, $permissions, array $optionalArgs = []) - { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); - } -} diff --git a/owl-bot-staging/PubSub/v1/src/V1/Gapic/SubscriberGapicClient.php b/owl-bot-staging/PubSub/v1/src/V1/Gapic/SubscriberGapicClient.php deleted file mode 100644 index 1eeff518c582..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/Gapic/SubscriberGapicClient.php +++ /dev/null @@ -1,1664 +0,0 @@ -subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - * $ackIds = []; - * $subscriberClient->acknowledge($formattedSubscription, $ackIds); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\PubSub\V1\Client\SubscriberClient}. - */ -class SubscriberGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.pubsub.v1.Subscriber'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'pubsub.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'pubsub.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/pubsub', - ]; - - private static $deletedTopicNameTemplate; - - private static $projectNameTemplate; - - private static $projectTopicNameTemplate; - - private static $snapshotNameTemplate; - - private static $subscriptionNameTemplate; - - private static $topicNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/subscriber_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/subscriber_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/subscriber_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/subscriber_rest_client_config.php', - ], - ], - ]; - } - - private static function getDeletedTopicNameTemplate() - { - if (self::$deletedTopicNameTemplate == null) { - self::$deletedTopicNameTemplate = new PathTemplate('_deleted-topic_'); - } - - return self::$deletedTopicNameTemplate; - } - - private static function getProjectNameTemplate() - { - if (self::$projectNameTemplate == null) { - self::$projectNameTemplate = new PathTemplate('projects/{project}'); - } - - return self::$projectNameTemplate; - } - - private static function getProjectTopicNameTemplate() - { - if (self::$projectTopicNameTemplate == null) { - self::$projectTopicNameTemplate = new PathTemplate('projects/{project}/topics/{topic}'); - } - - return self::$projectTopicNameTemplate; - } - - private static function getSnapshotNameTemplate() - { - if (self::$snapshotNameTemplate == null) { - self::$snapshotNameTemplate = new PathTemplate('projects/{project}/snapshots/{snapshot}'); - } - - return self::$snapshotNameTemplate; - } - - private static function getSubscriptionNameTemplate() - { - if (self::$subscriptionNameTemplate == null) { - self::$subscriptionNameTemplate = new PathTemplate('projects/{project}/subscriptions/{subscription}'); - } - - return self::$subscriptionNameTemplate; - } - - private static function getTopicNameTemplate() - { - if (self::$topicNameTemplate == null) { - self::$topicNameTemplate = new PathTemplate('projects/{project}/topics/{topic}'); - } - - return self::$topicNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'deletedTopic' => self::getDeletedTopicNameTemplate(), - 'project' => self::getProjectNameTemplate(), - 'projectTopic' => self::getProjectTopicNameTemplate(), - 'snapshot' => self::getSnapshotNameTemplate(), - 'subscription' => self::getSubscriptionNameTemplate(), - 'topic' => self::getTopicNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * _deleted-topic_ resource. - * - * @return string The formatted _deleted-topic_ resource. - */ - public static function deletedTopicName() - { - return self::getDeletedTopicNameTemplate()->render([]); - } - - /** - * Formats a string containing the fully-qualified path to represent a project - * resource. - * - * @param string $project - * - * @return string The formatted project resource. - */ - public static function projectName($project) - { - return self::getProjectNameTemplate()->render([ - 'project' => $project, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_topic resource. - * - * @param string $project - * @param string $topic - * - * @return string The formatted project_topic resource. - */ - public static function projectTopicName($project, $topic) - { - return self::getProjectTopicNameTemplate()->render([ - 'project' => $project, - 'topic' => $topic, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a snapshot - * resource. - * - * @param string $project - * @param string $snapshot - * - * @return string The formatted snapshot resource. - */ - public static function snapshotName($project, $snapshot) - { - return self::getSnapshotNameTemplate()->render([ - 'project' => $project, - 'snapshot' => $snapshot, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a subscription - * resource. - * - * @param string $project - * @param string $subscription - * - * @return string The formatted subscription resource. - */ - public static function subscriptionName($project, $subscription) - { - return self::getSubscriptionNameTemplate()->render([ - 'project' => $project, - 'subscription' => $subscription, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a topic - * resource. - * - * @param string $project - * @param string $topic - * - * @return string The formatted topic resource. - */ - public static function topicName($project, $topic) - { - return self::getTopicNameTemplate()->render([ - 'project' => $project, - 'topic' => $topic, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - deletedTopic: _deleted-topic_ - * - project: projects/{project} - * - projectTopic: projects/{project}/topics/{topic} - * - snapshot: projects/{project}/snapshots/{snapshot} - * - subscription: projects/{project}/subscriptions/{subscription} - * - topic: projects/{project}/topics/{topic} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'pubsub.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Acknowledges the messages associated with the `ack_ids` in the - * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages - * from the subscription. - * - * Acknowledging a message whose ack deadline has expired may succeed, - * but such a message may be redelivered later. Acknowledging a message more - * than once will not result in an error. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - * $ackIds = []; - * $subscriberClient->acknowledge($formattedSubscription, $ackIds); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $subscription Required. The subscription whose message is being acknowledged. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param string[] $ackIds Required. The acknowledgment ID for the messages being acknowledged that - * was returned by the Pub/Sub system in the `Pull` response. Must not be - * empty. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function acknowledge($subscription, $ackIds, array $optionalArgs = []) - { - $request = new AcknowledgeRequest(); - $requestParamHeaders = []; - $request->setSubscription($subscription); - $request->setAckIds($ackIds); - $requestParamHeaders['subscription'] = $subscription; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Acknowledge', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a snapshot from the requested subscription. Snapshots are used in - * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - * which allow you to manage message acknowledgments in bulk. That is, you can - * set the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * If the snapshot already exists, returns `ALREADY_EXISTS`. - * If the requested subscription doesn't exist, returns `NOT_FOUND`. - * If the backlog in the subscription is too old -- and the resulting snapshot - * would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. - * See also the `Snapshot.expire_time` field. If the name is not provided in - * the request, the server will assign a random - * name for this snapshot on the same project as the subscription, conforming - * to the [resource name format] - * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The - * generated name is populated in the returned Snapshot object. Note that for - * REST API requests, you must specify a name in the request. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $formattedName = $subscriberClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - * $response = $subscriberClient->createSnapshot($formattedName, $formattedSubscription); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $name Required. User-provided name for this snapshot. If the name is not provided - * in the request, the server will assign a random name for this snapshot on - * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the [resource name - * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). - * Format is `projects/{project}/snapshots/{snap}`. - * @param string $subscription Required. The subscription whose backlog the snapshot retains. - * Specifically, the created snapshot is guaranteed to retain: - * (a) The existing backlog on the subscription. More precisely, this is - * defined as the messages in the subscription's backlog that are - * unacknowledged upon the successful completion of the - * `CreateSnapshot` request; as well as: - * (b) Any messages published to the subscription's topic following the - * successful completion of the CreateSnapshot request. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param array $optionalArgs { - * Optional. - * - * @type array $labels - * Optional. See [Creating and managing - * labels](https://cloud.google.com/pubsub/docs/labels). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Snapshot - * - * @throws ApiException if the remote call fails - */ - public function createSnapshot($name, $subscription, array $optionalArgs = []) - { - $request = new CreateSnapshotRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setSubscription($subscription); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['labels'])) { - $request->setLabels($optionalArgs['labels']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CreateSnapshot', Snapshot::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a subscription to a given topic. See the [resource name rules] - * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). - * If the subscription already exists, returns `ALREADY_EXISTS`. - * If the corresponding topic doesn't exist, returns `NOT_FOUND`. - * - * If the name is not provided in the request, the server will assign a random - * name for this subscription on the same project as the topic, conforming - * to the [resource name format] - * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The - * generated name is populated in the returned Subscription object. Note that - * for REST API requests, you must specify a name in the request. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $name = 'name'; - * $formattedTopic = $subscriberClient->topicName('[PROJECT]', '[TOPIC]'); - * $response = $subscriberClient->createSubscription($name, $formattedTopic); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the subscription. It must have the format - * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` 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"`. - * @param string $topic Required. The name of the topic from which this subscription is receiving - * messages. Format is `projects/{project}/topics/{topic}`. The value of this - * field will be `_deleted-topic_` if the topic has been deleted. - * @param array $optionalArgs { - * Optional. - * - * @type PushConfig $pushConfig - * Optional. If push delivery is used with this subscription, this field is - * used to configure it. - * @type BigQueryConfig $bigqueryConfig - * Optional. If delivery to BigQuery is used with this subscription, this - * field is used to configure it. - * @type CloudStorageConfig $cloudStorageConfig - * Optional. If delivery to Google Cloud Storage is used with this - * subscription, this field is used to configure it. - * @type int $ackDeadlineSeconds - * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub - * waits for the subscriber to acknowledge receipt before resending the - * message. In the interval after the message is delivered and before it is - * acknowledged, it is considered to be _outstanding_. During that time - * period, the message will not be redelivered (on a best-effort basis). - * - * For pull subscriptions, this value is used as the initial value for the ack - * deadline. To override this value for a given message, call - * `ModifyAckDeadline` with the corresponding `ack_id` if using - * non-streaming pull or send the `ack_id` in a - * `StreamingModifyAckDeadlineRequest` if using streaming pull. - * The minimum custom deadline you can specify is 10 seconds. - * The maximum custom deadline you can specify is 600 seconds (10 minutes). - * If this parameter is 0, a default value of 10 seconds is used. - * - * For push delivery, this value is also used to set the request timeout for - * the call to the push endpoint. - * - * If the subscriber never acknowledges the message, the Pub/Sub - * system will eventually redeliver the message. - * @type bool $retainAckedMessages - * Optional. Indicates whether to retain acknowledged messages. If true, then - * messages are not expunged from the subscription's backlog, even if they are - * acknowledged, until they fall out of the `message_retention_duration` - * window. This must be true if you would like to [`Seek` to a timestamp] - * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in - * the past to replay previously-acknowledged messages. - * @type Duration $messageRetentionDuration - * Optional. How long to retain unacknowledged messages in the subscription's - * backlog, from the moment a message is published. If `retain_acked_messages` - * is true, then this also configures the retention of acknowledged messages, - * and thus configures how far back in time a `Seek` can be done. Defaults to - * 7 days. Cannot be more than 7 days or less than 10 minutes. - * @type array $labels - * Optional. See [Creating and managing - * labels](https://cloud.google.com/pubsub/docs/labels). - * @type bool $enableMessageOrdering - * Optional. If true, messages published with the same `ordering_key` in - * `PubsubMessage` will be delivered to the subscribers in the order in which - * they are received by the Pub/Sub system. Otherwise, they may be delivered - * in any order. - * @type ExpirationPolicy $expirationPolicy - * Optional. A policy that specifies the conditions for this subscription's - * expiration. A subscription is considered active as long as any connected - * subscriber is successfully consuming messages from the subscription or is - * issuing operations on the subscription. If `expiration_policy` is not set, - * a *default policy* with `ttl` of 31 days will be used. The minimum allowed - * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set, - * but `expiration_policy.ttl` is not set, the subscription never expires. - * @type string $filter - * Optional. An expression written in the Pub/Sub [filter - * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, - * then only `PubsubMessage`s whose `attributes` field matches the filter are - * delivered on this subscription. If empty, then no messages are filtered - * out. - * @type DeadLetterPolicy $deadLetterPolicy - * Optional. A policy that specifies the conditions for dead lettering - * messages in this subscription. If dead_letter_policy is not set, dead - * lettering is disabled. - * - * The Pub/Sub service account associated with this subscriptions's - * parent project (i.e., - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have - * permission to Acknowledge() messages on this subscription. - * @type RetryPolicy $retryPolicy - * Optional. A policy that specifies how Pub/Sub retries message delivery for - * this subscription. - * - * If not set, the default retry policy is applied. This generally implies - * that messages will be retried as soon as possible for healthy subscribers. - * RetryPolicy will be triggered on NACKs or acknowledgement deadline - * exceeded events for a given message. - * @type bool $detached - * Optional. Indicates whether the subscription is detached from its topic. - * Detached subscriptions don't receive messages from their topic and don't - * retain any backlog. `Pull` and `StreamingPull` requests will return - * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to - * the endpoint will not be made. - * @type bool $enableExactlyOnceDelivery - * Optional. If true, Pub/Sub provides the following guarantees for the - * delivery of a message with a given value of `message_id` on this - * subscription: - * - * * The message sent to a subscriber is guaranteed not to be resent - * before the message's acknowledgement deadline expires. - * * An acknowledged message will not be resent to a subscriber. - * - * Note that subscribers may still receive multiple copies of a message - * when `enable_exactly_once_delivery` is true if the message was published - * multiple times by a publisher client. These copies are considered distinct - * by Pub/Sub and have distinct `message_id` values. - * @type Duration $topicMessageRetentionDuration - * Output only. Indicates the minimum duration for which a message is retained - * after it is published to the subscription's topic. If this field is set, - * messages published to the subscription's topic in the last - * `topic_message_retention_duration` are always available to subscribers. See - * the `message_retention_duration` field in `Topic`. This field is set only - * in responses from the server; it is ignored if it is set in any requests. - * @type int $state - * Output only. An output-only field indicating whether or not the - * subscription can receive messages. - * For allowed values, use constants defined on {@see \Google\Cloud\PubSub\V1\Subscription\State} - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Subscription - * - * @throws ApiException if the remote call fails - */ - public function createSubscription($name, $topic, array $optionalArgs = []) - { - $request = new Subscription(); - $requestParamHeaders = []; - $request->setName($name); - $request->setTopic($topic); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['pushConfig'])) { - $request->setPushConfig($optionalArgs['pushConfig']); - } - - if (isset($optionalArgs['bigqueryConfig'])) { - $request->setBigqueryConfig($optionalArgs['bigqueryConfig']); - } - - if (isset($optionalArgs['cloudStorageConfig'])) { - $request->setCloudStorageConfig($optionalArgs['cloudStorageConfig']); - } - - if (isset($optionalArgs['ackDeadlineSeconds'])) { - $request->setAckDeadlineSeconds($optionalArgs['ackDeadlineSeconds']); - } - - if (isset($optionalArgs['retainAckedMessages'])) { - $request->setRetainAckedMessages($optionalArgs['retainAckedMessages']); - } - - if (isset($optionalArgs['messageRetentionDuration'])) { - $request->setMessageRetentionDuration($optionalArgs['messageRetentionDuration']); - } - - if (isset($optionalArgs['labels'])) { - $request->setLabels($optionalArgs['labels']); - } - - if (isset($optionalArgs['enableMessageOrdering'])) { - $request->setEnableMessageOrdering($optionalArgs['enableMessageOrdering']); - } - - if (isset($optionalArgs['expirationPolicy'])) { - $request->setExpirationPolicy($optionalArgs['expirationPolicy']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['deadLetterPolicy'])) { - $request->setDeadLetterPolicy($optionalArgs['deadLetterPolicy']); - } - - if (isset($optionalArgs['retryPolicy'])) { - $request->setRetryPolicy($optionalArgs['retryPolicy']); - } - - if (isset($optionalArgs['detached'])) { - $request->setDetached($optionalArgs['detached']); - } - - if (isset($optionalArgs['enableExactlyOnceDelivery'])) { - $request->setEnableExactlyOnceDelivery($optionalArgs['enableExactlyOnceDelivery']); - } - - if (isset($optionalArgs['topicMessageRetentionDuration'])) { - $request->setTopicMessageRetentionDuration($optionalArgs['topicMessageRetentionDuration']); - } - - if (isset($optionalArgs['state'])) { - $request->setState($optionalArgs['state']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CreateSubscription', Subscription::class, $optionalArgs, $request)->wait(); - } - - /** - * Removes an existing snapshot. Snapshots are used in [Seek] - * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set - * the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * When the snapshot is deleted, all messages retained in the snapshot - * are immediately dropped. After a snapshot is deleted, a new one may be - * created with the same name, but the new one has no association with the old - * snapshot or its subscription, unless the same subscription is specified. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $formattedSnapshot = $subscriberClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - * $subscriberClient->deleteSnapshot($formattedSnapshot); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $snapshot Required. The name of the snapshot to delete. - * Format is `projects/{project}/snapshots/{snap}`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteSnapshot($snapshot, array $optionalArgs = []) - { - $request = new DeleteSnapshotRequest(); - $requestParamHeaders = []; - $request->setSnapshot($snapshot); - $requestParamHeaders['snapshot'] = $snapshot; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteSnapshot', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Deletes an existing subscription. All messages retained in the subscription - * are immediately dropped. Calls to `Pull` after deletion will return - * `NOT_FOUND`. After a subscription is deleted, a new one may be created with - * the same name, but the new one has no association with the old - * subscription or its topic unless the same topic is specified. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - * $subscriberClient->deleteSubscription($formattedSubscription); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $subscription Required. The subscription to delete. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteSubscription($subscription, array $optionalArgs = []) - { - $request = new DeleteSubscriptionRequest(); - $requestParamHeaders = []; - $request->setSubscription($subscription); - $requestParamHeaders['subscription'] = $subscription; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteSubscription', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the configuration details of a snapshot. Snapshots are used in - * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - * which allow you to manage message acknowledgments in bulk. That is, you can - * set the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $formattedSnapshot = $subscriberClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - * $response = $subscriberClient->getSnapshot($formattedSnapshot); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $snapshot Required. The name of the snapshot to get. - * Format is `projects/{project}/snapshots/{snap}`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Snapshot - * - * @throws ApiException if the remote call fails - */ - public function getSnapshot($snapshot, array $optionalArgs = []) - { - $request = new GetSnapshotRequest(); - $requestParamHeaders = []; - $request->setSnapshot($snapshot); - $requestParamHeaders['snapshot'] = $snapshot; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetSnapshot', Snapshot::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the configuration details of a subscription. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - * $response = $subscriberClient->getSubscription($formattedSubscription); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $subscription Required. The name of the subscription to get. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Subscription - * - * @throws ApiException if the remote call fails - */ - public function getSubscription($subscription, array $optionalArgs = []) - { - $request = new GetSubscriptionRequest(); - $requestParamHeaders = []; - $request->setSubscription($subscription); - $requestParamHeaders['subscription'] = $subscription; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetSubscription', Subscription::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists the existing snapshots. Snapshots are used in [Seek]( - * https://cloud.google.com/pubsub/docs/replay-overview) operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set - * the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $formattedProject = $subscriberClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $subscriberClient->listSnapshots($formattedProject); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $subscriberClient->listSnapshots($formattedProject); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $project Required. The name of the project in which to list snapshots. - * Format is `projects/{project-id}`. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listSnapshots($project, array $optionalArgs = []) - { - $request = new ListSnapshotsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListSnapshots', $optionalArgs, ListSnapshotsResponse::class, $request); - } - - /** - * Lists matching subscriptions. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $formattedProject = $subscriberClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $subscriberClient->listSubscriptions($formattedProject); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $subscriberClient->listSubscriptions($formattedProject); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $project Required. The name of the project in which to list subscriptions. - * Format is `projects/{project-id}`. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listSubscriptions($project, array $optionalArgs = []) - { - $request = new ListSubscriptionsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListSubscriptions', $optionalArgs, ListSubscriptionsResponse::class, $request); - } - - /** - * Modifies the ack deadline for a specific message. This method is useful - * to indicate that more time is needed to process a message by the - * subscriber, or to make the message available for redelivery if the - * processing was interrupted. Note that this does not modify the - * subscription-level `ackDeadlineSeconds` used for subsequent messages. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - * $ackIds = []; - * $ackDeadlineSeconds = 0; - * $subscriberClient->modifyAckDeadline($formattedSubscription, $ackIds, $ackDeadlineSeconds); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $subscription Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param string[] $ackIds Required. List of acknowledgment IDs. - * @param int $ackDeadlineSeconds Required. The new ack deadline with respect to the time this request was - * sent to the Pub/Sub system. For example, if the value is 10, the new ack - * deadline will expire 10 seconds after the `ModifyAckDeadline` call was - * made. Specifying zero might immediately make the message available for - * delivery to another subscriber client. This typically results in an - * increase in the rate of message redeliveries (that is, duplicates). - * The minimum deadline you can specify is 0 seconds. - * The maximum deadline you can specify in a single request is 600 seconds - * (10 minutes). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function modifyAckDeadline($subscription, $ackIds, $ackDeadlineSeconds, array $optionalArgs = []) - { - $request = new ModifyAckDeadlineRequest(); - $requestParamHeaders = []; - $request->setSubscription($subscription); - $request->setAckIds($ackIds); - $request->setAckDeadlineSeconds($ackDeadlineSeconds); - $requestParamHeaders['subscription'] = $subscription; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ModifyAckDeadline', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Modifies the `PushConfig` for a specified subscription. - * - * This may be used to change a push subscription to a pull one (signified by - * an empty `PushConfig`) or vice versa, or change the endpoint URL and other - * attributes of a push subscription. Messages will accumulate for delivery - * continuously through the call regardless of changes to the `PushConfig`. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - * $pushConfig = new PushConfig(); - * $subscriberClient->modifyPushConfig($formattedSubscription, $pushConfig); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $subscription Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param PushConfig $pushConfig Required. The push configuration for future deliveries. - * - * An empty `pushConfig` indicates that the Pub/Sub system should - * stop pushing messages from the given subscription and allow - * messages to be pulled and acknowledged - effectively pausing - * the subscription if `Pull` or `StreamingPull` is not called. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function modifyPushConfig($subscription, $pushConfig, array $optionalArgs = []) - { - $request = new ModifyPushConfigRequest(); - $requestParamHeaders = []; - $request->setSubscription($subscription); - $request->setPushConfig($pushConfig); - $requestParamHeaders['subscription'] = $subscription; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ModifyPushConfig', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Pulls messages from the server. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - * $maxMessages = 0; - * $response = $subscriberClient->pull($formattedSubscription, $maxMessages); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $subscription Required. The subscription from which messages should be pulled. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param int $maxMessages Required. The maximum number of messages to return for this request. Must - * be a positive integer. The Pub/Sub system may return fewer than the number - * specified. - * @param array $optionalArgs { - * Optional. - * - * @type bool $returnImmediately - * Optional. If this field set to true, the system will respond immediately - * even if it there are no messages available to return in the `Pull` - * response. Otherwise, the system may wait (for a bounded amount of time) - * until at least one message is available, rather than returning no messages. - * Warning: setting this field to `true` is discouraged because it adversely - * impacts the performance of `Pull` operations. We recommend that users do - * not set this field. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\PullResponse - * - * @throws ApiException if the remote call fails - */ - public function pull($subscription, $maxMessages, array $optionalArgs = []) - { - $request = new PullRequest(); - $requestParamHeaders = []; - $request->setSubscription($subscription); - $request->setMaxMessages($maxMessages); - $requestParamHeaders['subscription'] = $subscription; - if (isset($optionalArgs['returnImmediately'])) { - $request->setReturnImmediately($optionalArgs['returnImmediately']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Pull', PullResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Seeks an existing subscription to a point in time or to a given snapshot, - * whichever is provided in the request. Snapshots are used in [Seek] - * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set - * the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. Note that both the subscription and the - * snapshot must be on the same topic. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - * $response = $subscriberClient->seek($formattedSubscription); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $subscription Required. The subscription to affect. - * @param array $optionalArgs { - * Optional. - * - * @type Timestamp $time - * Optional. The time to seek to. - * Messages retained in the subscription that were published before this - * time are marked as acknowledged, and messages retained in the - * subscription that were published after this time are marked as - * unacknowledged. Note that this operation affects only those messages - * retained in the subscription (configured by the combination of - * `message_retention_duration` and `retain_acked_messages`). For example, - * if `time` corresponds to a point before the message retention - * window (or to a point before the system's notion of the subscription - * creation time), only retained messages will be marked as unacknowledged, - * and already-expunged messages will not be restored. - * @type string $snapshot - * Optional. The snapshot to seek to. The snapshot's topic must be the same - * as that of the provided subscription. Format is - * `projects/{project}/snapshots/{snap}`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\SeekResponse - * - * @throws ApiException if the remote call fails - */ - public function seek($subscription, array $optionalArgs = []) - { - $request = new SeekRequest(); - $requestParamHeaders = []; - $request->setSubscription($subscription); - $requestParamHeaders['subscription'] = $subscription; - if (isset($optionalArgs['time'])) { - $request->setTime($optionalArgs['time']); - } - - if (isset($optionalArgs['snapshot'])) { - $request->setSnapshot($optionalArgs['snapshot']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Seek', SeekResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Establishes a stream with the server, which sends messages down to the - * client. The client streams acknowledgements and ack deadline modifications - * back to the server. The server will close the stream and return the status - * on any error. The server may close the stream with status `UNAVAILABLE` to - * reassign server-side resources, in which case, the client should - * re-establish the stream. Flow control can be achieved by configuring the - * underlying RPC channel. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $subscription = 'subscription'; - * $streamAckDeadlineSeconds = 0; - * $request = new StreamingPullRequest(); - * $request->setSubscription($subscription); - * $request->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds); - * // Write all requests to the server, then read all responses until the - * // stream is complete - * $requests = [ - * $request, - * ]; - * $stream = $subscriberClient->streamingPull(); - * $stream->writeAll($requests); - * foreach ($stream->closeWriteAndReadAll() as $element) { - * // doSomethingWith($element); - * } - * // Alternatively: - * // Write requests individually, making read() calls if - * // required. Call closeWrite() once writes are complete, and read the - * // remaining responses from the server. - * $requests = [ - * $request, - * ]; - * $stream = $subscriberClient->streamingPull(); - * foreach ($requests as $request) { - * $stream->write($request); - * // if required, read a single response from the stream - * $element = $stream->read(); - * // doSomethingWith($element) - * } - * $stream->closeWrite(); - * $element = $stream->read(); - * while (!is_null($element)) { - * // doSomethingWith($element) - * $element = $stream->read(); - * } - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\BidiStream - * - * @throws ApiException if the remote call fails - */ - public function streamingPull(array $optionalArgs = []) - { - return $this->startCall('StreamingPull', StreamingPullResponse::class, $optionalArgs, null, Call::BIDI_STREAMING_CALL); - } - - /** - * Updates an existing snapshot by updating the fields specified in the update - * mask. Snapshots are used in - * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - * which allow you to manage message acknowledgments in bulk. That is, you can - * set the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $snapshot = new Snapshot(); - * $updateMask = new FieldMask(); - * $response = $subscriberClient->updateSnapshot($snapshot, $updateMask); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param Snapshot $snapshot Required. The updated snapshot object. - * @param FieldMask $updateMask Required. Indicates which fields in the provided snapshot to update. - * Must be specified and non-empty. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Snapshot - * - * @throws ApiException if the remote call fails - */ - public function updateSnapshot($snapshot, $updateMask, array $optionalArgs = []) - { - $request = new UpdateSnapshotRequest(); - $requestParamHeaders = []; - $request->setSnapshot($snapshot); - $request->setUpdateMask($updateMask); - $requestParamHeaders['snapshot.name'] = $snapshot->getName(); - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('UpdateSnapshot', Snapshot::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates an existing subscription by updating the fields specified in the - * update mask. Note that certain properties of a subscription, such as its - * topic, are not modifiable. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $subscription = new Subscription(); - * $updateMask = new FieldMask(); - * $response = $subscriberClient->updateSubscription($subscription, $updateMask); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param Subscription $subscription Required. The updated subscription object. - * @param FieldMask $updateMask Required. Indicates which fields in the provided subscription to update. - * Must be specified and non-empty. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\PubSub\V1\Subscription - * - * @throws ApiException if the remote call fails - */ - public function updateSubscription($subscription, $updateMask, array $optionalArgs = []) - { - $request = new UpdateSubscriptionRequest(); - $requestParamHeaders = []; - $request->setSubscription($subscription); - $request->setUpdateMask($updateMask); - $requestParamHeaders['subscription.name'] = $subscription->getName(); - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('UpdateSubscription', Subscription::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $resource = 'resource'; - * $response = $subscriberClient->getIamPolicy($resource); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $subscriberClient->setIamPolicy($resource, $policy); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); - } - - /** - * 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. - * - * Sample code: - * ``` - * $subscriberClient = new SubscriberClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $subscriberClient->testIamPermissions($resource, $permissions); - * } finally { - * $subscriberClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($resource, $permissions, array $optionalArgs = []) - { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); - } -} diff --git a/owl-bot-staging/PubSub/v1/src/V1/PublisherClient.php b/owl-bot-staging/PubSub/v1/src/V1/PublisherClient.php deleted file mode 100644 index deefc784c64f..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/PublisherClient.php +++ /dev/null @@ -1,34 +0,0 @@ - [ - 'google.pubsub.v1.Publisher' => [ - 'CreateTopic' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Topic', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'DeleteTopic' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'topic', - 'fieldAccessors' => [ - 'getTopic', - ], - ], - ], - ], - 'DetachSubscription' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\DetachSubscriptionResponse', - 'headerParams' => [ - [ - 'keyName' => 'subscription', - 'fieldAccessors' => [ - 'getSubscription', - ], - ], - ], - ], - 'GetTopic' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Topic', - 'headerParams' => [ - [ - 'keyName' => 'topic', - 'fieldAccessors' => [ - 'getTopic', - ], - ], - ], - ], - 'ListTopicSnapshots' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getSnapshots', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\ListTopicSnapshotsResponse', - 'headerParams' => [ - [ - 'keyName' => 'topic', - 'fieldAccessors' => [ - 'getTopic', - ], - ], - ], - ], - 'ListTopicSubscriptions' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getSubscriptions', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\ListTopicSubscriptionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'topic', - 'fieldAccessors' => [ - 'getTopic', - ], - ], - ], - ], - 'ListTopics' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getTopics', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\ListTopicsResponse', - 'headerParams' => [ - [ - 'keyName' => 'project', - 'fieldAccessors' => [ - 'getProject', - ], - ], - ], - ], - 'Publish' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\PublishResponse', - 'headerParams' => [ - [ - 'keyName' => 'topic', - 'fieldAccessors' => [ - 'getTopic', - ], - ], - ], - ], - 'UpdateTopic' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Topic', - 'headerParams' => [ - [ - 'keyName' => 'topic.name', - 'fieldAccessors' => [ - 'getTopic', - 'getName', - ], - ], - ], - ], - 'GetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'SetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'TestIamPermissions' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'templateMap' => [ - 'deletedTopic' => '_deleted-topic_', - 'project' => 'projects/{project}', - 'projectTopic' => 'projects/{project}/topics/{topic}', - 'schema' => 'projects/{project}/schemas/{schema}', - 'subscription' => 'projects/{project}/subscriptions/{subscription}', - 'topic' => 'projects/{project}/topics/{topic}', - ], - ], - ], -]; diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/publisher_rest_client_config.php b/owl-bot-staging/PubSub/v1/src/V1/resources/publisher_rest_client_config.php deleted file mode 100644 index a62253330e66..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/resources/publisher_rest_client_config.php +++ /dev/null @@ -1,217 +0,0 @@ - [ - 'google.iam.v1.IAMPolicy' => [ - 'GetIamPolicy' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:getIamPolicy', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:getIamPolicy', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:getIamPolicy', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:getIamPolicy', - ], - ], - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'SetIamPolicy' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:setIamPolicy', - 'body' => '*', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:setIamPolicy', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:setIamPolicy', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:setIamPolicy', - 'body' => '*', - ], - ], - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'TestIamPermissions' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:testIamPermissions', - 'body' => '*', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:testIamPermissions', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:testIamPermissions', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:testIamPermissions', - 'body' => '*', - ], - ], - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - ], - 'google.pubsub.v1.Publisher' => [ - 'CreateTopic' => [ - 'method' => 'put', - 'uriTemplate' => '/v1/{name=projects/*/topics/*}', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DeleteTopic' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{topic=projects/*/topics/*}', - 'placeholders' => [ - 'topic' => [ - 'getters' => [ - 'getTopic', - ], - ], - ], - ], - 'DetachSubscription' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}:detach', - 'placeholders' => [ - 'subscription' => [ - 'getters' => [ - 'getSubscription', - ], - ], - ], - ], - 'GetTopic' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{topic=projects/*/topics/*}', - 'placeholders' => [ - 'topic' => [ - 'getters' => [ - 'getTopic', - ], - ], - ], - ], - 'ListTopicSnapshots' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{topic=projects/*/topics/*}/snapshots', - 'placeholders' => [ - 'topic' => [ - 'getters' => [ - 'getTopic', - ], - ], - ], - ], - 'ListTopicSubscriptions' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{topic=projects/*/topics/*}/subscriptions', - 'placeholders' => [ - 'topic' => [ - 'getters' => [ - 'getTopic', - ], - ], - ], - ], - 'ListTopics' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{project=projects/*}/topics', - 'placeholders' => [ - 'project' => [ - 'getters' => [ - 'getProject', - ], - ], - ], - ], - 'Publish' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{topic=projects/*/topics/*}:publish', - 'body' => '*', - 'placeholders' => [ - 'topic' => [ - 'getters' => [ - 'getTopic', - ], - ], - ], - ], - 'UpdateTopic' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{topic.name=projects/*/topics/*}', - 'body' => '*', - 'placeholders' => [ - 'topic.name' => [ - 'getters' => [ - 'getTopic', - 'getName', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_client_config.json b/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_client_config.json deleted file mode 100644 index 2773e2ae2d5e..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_client_config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "interfaces": { - "google.pubsub.v1.SchemaService": { - "retry_codes": { - "no_retry_codes": [], - "retry_policy_8_codes": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0 - }, - "retry_policy_8_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000 - } - }, - "methods": { - "CommitSchema": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_8_codes", - "retry_params_name": "retry_policy_8_params" - }, - "CreateSchema": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_8_codes", - "retry_params_name": "retry_policy_8_params" - }, - "DeleteSchema": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_8_codes", - "retry_params_name": "retry_policy_8_params" - }, - "DeleteSchemaRevision": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_8_codes", - "retry_params_name": "retry_policy_8_params" - }, - "GetSchema": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_8_codes", - "retry_params_name": "retry_policy_8_params" - }, - "ListSchemaRevisions": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_8_codes", - "retry_params_name": "retry_policy_8_params" - }, - "ListSchemas": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_8_codes", - "retry_params_name": "retry_policy_8_params" - }, - "RollbackSchema": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_8_codes", - "retry_params_name": "retry_policy_8_params" - }, - "ValidateMessage": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_8_codes", - "retry_params_name": "retry_policy_8_params" - }, - "ValidateSchema": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_8_codes", - "retry_params_name": "retry_policy_8_params" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - } - } - } - } -} diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_descriptor_config.php b/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_descriptor_config.php deleted file mode 100644 index f11afb7e2cf1..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_descriptor_config.php +++ /dev/null @@ -1,207 +0,0 @@ - [ - 'google.pubsub.v1.SchemaService' => [ - 'CommitSchema' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Schema', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'CreateSchema' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Schema', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'DeleteSchema' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'DeleteSchemaRevision' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Schema', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'GetSchema' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Schema', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'ListSchemaRevisions' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getSchemas', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\ListSchemaRevisionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'ListSchemas' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getSchemas', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\ListSchemasResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'RollbackSchema' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Schema', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'ValidateMessage' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\ValidateMessageResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ValidateSchema' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\ValidateSchemaResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'GetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'SetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'TestIamPermissions' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'templateMap' => [ - 'project' => 'projects/{project}', - 'schema' => 'projects/{project}/schemas/{schema}', - ], - ], - ], -]; diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_rest_client_config.php b/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_rest_client_config.php deleted file mode 100644 index db359582076c..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/resources/schema_service_rest_client_config.php +++ /dev/null @@ -1,229 +0,0 @@ - [ - 'google.iam.v1.IAMPolicy' => [ - 'GetIamPolicy' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:getIamPolicy', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:getIamPolicy', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:getIamPolicy', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:getIamPolicy', - ], - ], - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'SetIamPolicy' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:setIamPolicy', - 'body' => '*', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:setIamPolicy', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:setIamPolicy', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:setIamPolicy', - 'body' => '*', - ], - ], - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'TestIamPermissions' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:testIamPermissions', - 'body' => '*', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:testIamPermissions', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:testIamPermissions', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:testIamPermissions', - 'body' => '*', - ], - ], - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - ], - 'google.pubsub.v1.SchemaService' => [ - 'CommitSchema' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/schemas/*}:commit', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'CreateSchema' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*}/schemas', - 'body' => 'schema', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'DeleteSchema' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/schemas/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DeleteSchemaRevision' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/schemas/*}:deleteRevision', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetSchema' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/schemas/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListSchemaRevisions' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/schemas/*}:listRevisions', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListSchemas' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*}/schemas', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'RollbackSchema' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/schemas/*}:rollback', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ValidateMessage' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*}/schemas:validateMessage', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ValidateSchema' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*}/schemas:validate', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_client_config.json b/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_client_config.json deleted file mode 100644 index c4812e9de3f8..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_client_config.json +++ /dev/null @@ -1,172 +0,0 @@ -{ - "interfaces": { - "google.pubsub.v1.Subscriber": { - "retry_codes": { - "no_retry_codes": [], - "retry_policy_4_codes": [ - "DEADLINE_EXCEEDED", - "RESOURCE_EXHAUSTED", - "ABORTED", - "INTERNAL", - "UNAVAILABLE" - ], - "retry_policy_5_codes": [ - "UNKNOWN", - "ABORTED", - "UNAVAILABLE", - "INTERNAL" - ], - "retry_policy_6_codes": [ - "UNKNOWN", - "ABORTED", - "UNAVAILABLE" - ], - "retry_policy_7_codes": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0 - }, - "retry_policy_4_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 4.0, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 900000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 900000, - "total_timeout_millis": 900000 - }, - "retry_policy_5_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000 - }, - "retry_policy_6_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000 - }, - "retry_policy_7_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000 - } - }, - "methods": { - "Acknowledge": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_7_codes", - "retry_params_name": "retry_policy_7_params" - }, - "CreateSnapshot": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_7_codes", - "retry_params_name": "retry_policy_7_params" - }, - "CreateSubscription": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_6_codes", - "retry_params_name": "retry_policy_6_params" - }, - "DeleteSnapshot": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_7_codes", - "retry_params_name": "retry_policy_7_params" - }, - "DeleteSubscription": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_7_codes", - "retry_params_name": "retry_policy_7_params" - }, - "GetSnapshot": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_6_codes", - "retry_params_name": "retry_policy_6_params" - }, - "GetSubscription": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_6_codes", - "retry_params_name": "retry_policy_6_params" - }, - "ListSnapshots": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_6_codes", - "retry_params_name": "retry_policy_6_params" - }, - "ListSubscriptions": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_6_codes", - "retry_params_name": "retry_policy_6_params" - }, - "ModifyAckDeadline": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_7_codes", - "retry_params_name": "retry_policy_7_params" - }, - "ModifyPushConfig": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_7_codes", - "retry_params_name": "retry_policy_7_params" - }, - "Pull": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_5_codes", - "retry_params_name": "retry_policy_5_params" - }, - "Seek": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_6_codes", - "retry_params_name": "retry_policy_6_params" - }, - "StreamingPull": { - "timeout_millis": 900000 - }, - "UpdateSnapshot": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_7_codes", - "retry_params_name": "retry_policy_7_params" - }, - "UpdateSubscription": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_7_codes", - "retry_params_name": "retry_policy_7_params" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_6_codes", - "retry_params_name": "retry_policy_6_params" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_7_codes", - "retry_params_name": "retry_policy_7_params" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_7_codes", - "retry_params_name": "retry_policy_7_params" - } - } - } - } -} diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_descriptor_config.php b/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_descriptor_config.php deleted file mode 100644 index 4b0fead59008..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_descriptor_config.php +++ /dev/null @@ -1,280 +0,0 @@ - [ - 'google.pubsub.v1.Subscriber' => [ - 'Acknowledge' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'subscription', - 'fieldAccessors' => [ - 'getSubscription', - ], - ], - ], - ], - 'CreateSnapshot' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Snapshot', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'CreateSubscription' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Subscription', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'DeleteSnapshot' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'snapshot', - 'fieldAccessors' => [ - 'getSnapshot', - ], - ], - ], - ], - 'DeleteSubscription' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'subscription', - 'fieldAccessors' => [ - 'getSubscription', - ], - ], - ], - ], - 'GetSnapshot' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Snapshot', - 'headerParams' => [ - [ - 'keyName' => 'snapshot', - 'fieldAccessors' => [ - 'getSnapshot', - ], - ], - ], - ], - 'GetSubscription' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Subscription', - 'headerParams' => [ - [ - 'keyName' => 'subscription', - 'fieldAccessors' => [ - 'getSubscription', - ], - ], - ], - ], - 'ListSnapshots' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getSnapshots', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\ListSnapshotsResponse', - 'headerParams' => [ - [ - 'keyName' => 'project', - 'fieldAccessors' => [ - 'getProject', - ], - ], - ], - ], - 'ListSubscriptions' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getSubscriptions', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\ListSubscriptionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'project', - 'fieldAccessors' => [ - 'getProject', - ], - ], - ], - ], - 'ModifyAckDeadline' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'subscription', - 'fieldAccessors' => [ - 'getSubscription', - ], - ], - ], - ], - 'ModifyPushConfig' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'subscription', - 'fieldAccessors' => [ - 'getSubscription', - ], - ], - ], - ], - 'Pull' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\PullResponse', - 'headerParams' => [ - [ - 'keyName' => 'subscription', - 'fieldAccessors' => [ - 'getSubscription', - ], - ], - ], - ], - 'Seek' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\SeekResponse', - 'headerParams' => [ - [ - 'keyName' => 'subscription', - 'fieldAccessors' => [ - 'getSubscription', - ], - ], - ], - ], - 'StreamingPull' => [ - 'grpcStreaming' => [ - 'grpcStreamingType' => 'BidiStreaming', - ], - 'callType' => \Google\ApiCore\Call::BIDI_STREAMING_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\StreamingPullResponse', - ], - 'UpdateSnapshot' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Snapshot', - 'headerParams' => [ - [ - 'keyName' => 'snapshot.name', - 'fieldAccessors' => [ - 'getSnapshot', - 'getName', - ], - ], - ], - ], - 'UpdateSubscription' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\PubSub\V1\Subscription', - 'headerParams' => [ - [ - 'keyName' => 'subscription.name', - 'fieldAccessors' => [ - 'getSubscription', - 'getName', - ], - ], - ], - ], - 'GetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'SetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'TestIamPermissions' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'templateMap' => [ - 'deletedTopic' => '_deleted-topic_', - 'project' => 'projects/{project}', - 'projectTopic' => 'projects/{project}/topics/{topic}', - 'snapshot' => 'projects/{project}/snapshots/{snapshot}', - 'subscription' => 'projects/{project}/subscriptions/{subscription}', - 'topic' => 'projects/{project}/topics/{topic}', - ], - ], - ], -]; diff --git a/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_rest_client_config.php b/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_rest_client_config.php deleted file mode 100644 index e39849a42744..000000000000 --- a/owl-bot-staging/PubSub/v1/src/V1/resources/subscriber_rest_client_config.php +++ /dev/null @@ -1,290 +0,0 @@ - [ - 'google.iam.v1.IAMPolicy' => [ - 'GetIamPolicy' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:getIamPolicy', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:getIamPolicy', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:getIamPolicy', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:getIamPolicy', - ], - ], - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'SetIamPolicy' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:setIamPolicy', - 'body' => '*', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:setIamPolicy', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:setIamPolicy', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:setIamPolicy', - 'body' => '*', - ], - ], - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'TestIamPermissions' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/subscriptions/*}:testIamPermissions', - 'body' => '*', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/topics/*}:testIamPermissions', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/snapshots/*}:testIamPermissions', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/schemas/*}:testIamPermissions', - 'body' => '*', - ], - ], - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - ], - 'google.pubsub.v1.Subscriber' => [ - 'Acknowledge' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}:acknowledge', - 'body' => '*', - 'placeholders' => [ - 'subscription' => [ - 'getters' => [ - 'getSubscription', - ], - ], - ], - ], - 'CreateSnapshot' => [ - 'method' => 'put', - 'uriTemplate' => '/v1/{name=projects/*/snapshots/*}', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'CreateSubscription' => [ - 'method' => 'put', - 'uriTemplate' => '/v1/{name=projects/*/subscriptions/*}', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DeleteSnapshot' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{snapshot=projects/*/snapshots/*}', - 'placeholders' => [ - 'snapshot' => [ - 'getters' => [ - 'getSnapshot', - ], - ], - ], - ], - 'DeleteSubscription' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}', - 'placeholders' => [ - 'subscription' => [ - 'getters' => [ - 'getSubscription', - ], - ], - ], - ], - 'GetSnapshot' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{snapshot=projects/*/snapshots/*}', - 'placeholders' => [ - 'snapshot' => [ - 'getters' => [ - 'getSnapshot', - ], - ], - ], - ], - 'GetSubscription' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}', - 'placeholders' => [ - 'subscription' => [ - 'getters' => [ - 'getSubscription', - ], - ], - ], - ], - 'ListSnapshots' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{project=projects/*}/snapshots', - 'placeholders' => [ - 'project' => [ - 'getters' => [ - 'getProject', - ], - ], - ], - ], - 'ListSubscriptions' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{project=projects/*}/subscriptions', - 'placeholders' => [ - 'project' => [ - 'getters' => [ - 'getProject', - ], - ], - ], - ], - 'ModifyAckDeadline' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline', - 'body' => '*', - 'placeholders' => [ - 'subscription' => [ - 'getters' => [ - 'getSubscription', - ], - ], - ], - ], - 'ModifyPushConfig' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig', - 'body' => '*', - 'placeholders' => [ - 'subscription' => [ - 'getters' => [ - 'getSubscription', - ], - ], - ], - ], - 'Pull' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}:pull', - 'body' => '*', - 'placeholders' => [ - 'subscription' => [ - 'getters' => [ - 'getSubscription', - ], - ], - ], - ], - 'Seek' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{subscription=projects/*/subscriptions/*}:seek', - 'body' => '*', - 'placeholders' => [ - 'subscription' => [ - 'getters' => [ - 'getSubscription', - ], - ], - ], - ], - 'UpdateSnapshot' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{snapshot.name=projects/*/snapshots/*}', - 'body' => '*', - 'placeholders' => [ - 'snapshot.name' => [ - 'getters' => [ - 'getSnapshot', - 'getName', - ], - ], - ], - ], - 'UpdateSubscription' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{subscription.name=projects/*/subscriptions/*}', - 'body' => '*', - 'placeholders' => [ - 'subscription.name' => [ - 'getters' => [ - 'getSubscription', - 'getName', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/PublisherClientTest.php b/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/PublisherClientTest.php deleted file mode 100644 index a14d598012b9..000000000000 --- a/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/PublisherClientTest.php +++ /dev/null @@ -1,941 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return PublisherClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new PublisherClient($options); - } - - /** @test */ - public function createTopicTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $kmsKeyName2 = 'kmsKeyName2-1057489140'; - $satisfiesPzs2 = true; - $expectedResponse = new Topic(); - $expectedResponse->setName($name2); - $expectedResponse->setKmsKeyName($kmsKeyName2); - $expectedResponse->setSatisfiesPzs($satisfiesPzs2); - $transport->addResponse($expectedResponse); - // Mock request - $name = 'name3373707'; - $request = (new Topic()) - ->setName($name); - $response = $gapicClient->createTopic($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/CreateTopic', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTopicExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $name = 'name3373707'; - $request = (new Topic()) - ->setName($name); - try { - $gapicClient->createTopic($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTopicTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $request = (new DeleteTopicRequest()) - ->setTopic($formattedTopic); - $gapicClient->deleteTopic($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/DeleteTopic', $actualFuncCall); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($formattedTopic, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTopicExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $request = (new DeleteTopicRequest()) - ->setTopic($formattedTopic); - try { - $gapicClient->deleteTopic($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function detachSubscriptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new DetachSubscriptionResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $request = (new DetachSubscriptionRequest()) - ->setSubscription($formattedSubscription); - $response = $gapicClient->detachSubscription($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/DetachSubscription', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function detachSubscriptionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $request = (new DetachSubscriptionRequest()) - ->setSubscription($formattedSubscription); - try { - $gapicClient->detachSubscription($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTopicTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $kmsKeyName = 'kmsKeyName2094986649'; - $satisfiesPzs = false; - $expectedResponse = new Topic(); - $expectedResponse->setName($name); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $request = (new GetTopicRequest()) - ->setTopic($formattedTopic); - $response = $gapicClient->getTopic($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/GetTopic', $actualFuncCall); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($formattedTopic, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTopicExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $request = (new GetTopicRequest()) - ->setTopic($formattedTopic); - try { - $gapicClient->getTopic($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTopicSnapshotsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $snapshotsElement = 'snapshotsElement1339034092'; - $snapshots = [ - $snapshotsElement, - ]; - $expectedResponse = new ListTopicSnapshotsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSnapshots($snapshots); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $request = (new ListTopicSnapshotsRequest()) - ->setTopic($formattedTopic); - $response = $gapicClient->listTopicSnapshots($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSnapshots()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/ListTopicSnapshots', $actualFuncCall); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($formattedTopic, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTopicSnapshotsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $request = (new ListTopicSnapshotsRequest()) - ->setTopic($formattedTopic); - try { - $gapicClient->listTopicSnapshots($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTopicSubscriptionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $subscriptionsElement = 'subscriptionsElement1698708147'; - $subscriptions = [ - $subscriptionsElement, - ]; - $expectedResponse = new ListTopicSubscriptionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSubscriptions($subscriptions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $request = (new ListTopicSubscriptionsRequest()) - ->setTopic($formattedTopic); - $response = $gapicClient->listTopicSubscriptions($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSubscriptions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/ListTopicSubscriptions', $actualFuncCall); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($formattedTopic, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTopicSubscriptionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $request = (new ListTopicSubscriptionsRequest()) - ->setTopic($formattedTopic); - try { - $gapicClient->listTopicSubscriptions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTopicsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $topicsElement = new Topic(); - $topics = [ - $topicsElement, - ]; - $expectedResponse = new ListTopicsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTopics($topics); - $transport->addResponse($expectedResponse); - // Mock request - $formattedProject = $gapicClient->projectName('[PROJECT]'); - $request = (new ListTopicsRequest()) - ->setProject($formattedProject); - $response = $gapicClient->listTopics($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getTopics()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/ListTopics', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($formattedProject, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTopicsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedProject = $gapicClient->projectName('[PROJECT]'); - $request = (new ListTopicsRequest()) - ->setProject($formattedProject); - try { - $gapicClient->listTopics($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function publishTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new PublishResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $messages = []; - $request = (new PublishRequest()) - ->setTopic($formattedTopic) - ->setMessages($messages); - $response = $gapicClient->publish($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/Publish', $actualFuncCall); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($formattedTopic, $actualValue); - $actualValue = $actualRequestObject->getMessages(); - $this->assertProtobufEquals($messages, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function publishExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $messages = []; - $request = (new PublishRequest()) - ->setTopic($formattedTopic) - ->setMessages($messages); - try { - $gapicClient->publish($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTopicTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $kmsKeyName = 'kmsKeyName2094986649'; - $satisfiesPzs = false; - $expectedResponse = new Topic(); - $expectedResponse->setName($name); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $transport->addResponse($expectedResponse); - // Mock request - $topic = new Topic(); - $topicName = 'topicName388205658'; - $topic->setName($topicName); - $updateMask = new FieldMask(); - $request = (new UpdateTopicRequest()) - ->setTopic($topic) - ->setUpdateMask($updateMask); - $response = $gapicClient->updateTopic($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/UpdateTopic', $actualFuncCall); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($topic, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTopicExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $topic = new Topic(); - $topicName = 'topicName388205658'; - $topic->setName($topicName); - $updateMask = new FieldMask(); - $request = (new UpdateTopicRequest()) - ->setTopic($topic) - ->setUpdateMask($updateMask); - try { - $gapicClient->updateTopic($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - $response = $gapicClient->getIamPolicy($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - try { - $gapicClient->getIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - $response = $gapicClient->setIamPolicy($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - try { - $gapicClient->setIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - $response = $gapicClient->testIamPermissions($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - try { - $gapicClient->testIamPermissions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTopicAsyncTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $kmsKeyName2 = 'kmsKeyName2-1057489140'; - $satisfiesPzs2 = true; - $expectedResponse = new Topic(); - $expectedResponse->setName($name2); - $expectedResponse->setKmsKeyName($kmsKeyName2); - $expectedResponse->setSatisfiesPzs($satisfiesPzs2); - $transport->addResponse($expectedResponse); - // Mock request - $name = 'name3373707'; - $request = (new Topic()) - ->setName($name); - $response = $gapicClient->createTopicAsync($request)->wait(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/CreateTopic', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SchemaServiceClientTest.php b/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SchemaServiceClientTest.php deleted file mode 100644 index cb6a7fbd7218..000000000000 --- a/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SchemaServiceClientTest.php +++ /dev/null @@ -1,1037 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return SchemaServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new SchemaServiceClient($options); - } - - /** @test */ - public function commitSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $definition = 'definition-1014418093'; - $revisionId = 'revisionId513861631'; - $expectedResponse = new Schema(); - $expectedResponse->setName($name2); - $expectedResponse->setDefinition($definition); - $expectedResponse->setRevisionId($revisionId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $schema = new Schema(); - $schemaName = 'schemaName-448762932'; - $schema->setName($schemaName); - $request = (new CommitSchemaRequest()) - ->setName($formattedName) - ->setSchema($schema); - $response = $gapicClient->commitSchema($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/CommitSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualRequestObject->getSchema(); - $this->assertProtobufEquals($schema, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function commitSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $schema = new Schema(); - $schemaName = 'schemaName-448762932'; - $schema->setName($schemaName); - $request = (new CommitSchemaRequest()) - ->setName($formattedName) - ->setSchema($schema); - try { - $gapicClient->commitSchema($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $definition = 'definition-1014418093'; - $revisionId = 'revisionId513861631'; - $expectedResponse = new Schema(); - $expectedResponse->setName($name); - $expectedResponse->setDefinition($definition); - $expectedResponse->setRevisionId($revisionId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $schema = new Schema(); - $schemaName = 'schemaName-448762932'; - $schema->setName($schemaName); - $request = (new CreateSchemaRequest()) - ->setParent($formattedParent) - ->setSchema($schema); - $response = $gapicClient->createSchema($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/CreateSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getSchema(); - $this->assertProtobufEquals($schema, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $schema = new Schema(); - $schemaName = 'schemaName-448762932'; - $schema->setName($schemaName); - $request = (new CreateSchemaRequest()) - ->setParent($formattedParent) - ->setSchema($schema); - try { - $gapicClient->createSchema($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $request = (new DeleteSchemaRequest()) - ->setName($formattedName); - $gapicClient->deleteSchema($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/DeleteSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $request = (new DeleteSchemaRequest()) - ->setName($formattedName); - try { - $gapicClient->deleteSchema($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSchemaRevisionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $definition = 'definition-1014418093'; - $revisionId2 = 'revisionId2-100208654'; - $expectedResponse = new Schema(); - $expectedResponse->setName($name2); - $expectedResponse->setDefinition($definition); - $expectedResponse->setRevisionId($revisionId2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $revisionId = 'revisionId513861631'; - $request = (new DeleteSchemaRevisionRequest()) - ->setName($formattedName) - ->setRevisionId($revisionId); - $response = $gapicClient->deleteSchemaRevision($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/DeleteSchemaRevision', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualRequestObject->getRevisionId(); - $this->assertProtobufEquals($revisionId, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSchemaRevisionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $revisionId = 'revisionId513861631'; - $request = (new DeleteSchemaRevisionRequest()) - ->setName($formattedName) - ->setRevisionId($revisionId); - try { - $gapicClient->deleteSchemaRevision($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $definition = 'definition-1014418093'; - $revisionId = 'revisionId513861631'; - $expectedResponse = new Schema(); - $expectedResponse->setName($name2); - $expectedResponse->setDefinition($definition); - $expectedResponse->setRevisionId($revisionId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $request = (new GetSchemaRequest()) - ->setName($formattedName); - $response = $gapicClient->getSchema($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/GetSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $request = (new GetSchemaRequest()) - ->setName($formattedName); - try { - $gapicClient->getSchema($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSchemaRevisionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $schemasElement = new Schema(); - $schemas = [ - $schemasElement, - ]; - $expectedResponse = new ListSchemaRevisionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSchemas($schemas); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $request = (new ListSchemaRevisionsRequest()) - ->setName($formattedName); - $response = $gapicClient->listSchemaRevisions($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSchemas()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/ListSchemaRevisions', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSchemaRevisionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $request = (new ListSchemaRevisionsRequest()) - ->setName($formattedName); - try { - $gapicClient->listSchemaRevisions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSchemasTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $schemasElement = new Schema(); - $schemas = [ - $schemasElement, - ]; - $expectedResponse = new ListSchemasResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSchemas($schemas); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListSchemasRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listSchemas($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSchemas()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/ListSchemas', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSchemasExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListSchemasRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listSchemas($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function rollbackSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $definition = 'definition-1014418093'; - $revisionId2 = 'revisionId2-100208654'; - $expectedResponse = new Schema(); - $expectedResponse->setName($name2); - $expectedResponse->setDefinition($definition); - $expectedResponse->setRevisionId($revisionId2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $revisionId = 'revisionId513861631'; - $request = (new RollbackSchemaRequest()) - ->setName($formattedName) - ->setRevisionId($revisionId); - $response = $gapicClient->rollbackSchema($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/RollbackSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualRequestObject->getRevisionId(); - $this->assertProtobufEquals($revisionId, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function rollbackSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $revisionId = 'revisionId513861631'; - $request = (new RollbackSchemaRequest()) - ->setName($formattedName) - ->setRevisionId($revisionId); - try { - $gapicClient->rollbackSchema($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function validateMessageTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ValidateMessageResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ValidateMessageRequest()) - ->setParent($formattedParent); - $response = $gapicClient->validateMessage($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/ValidateMessage', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function validateMessageExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ValidateMessageRequest()) - ->setParent($formattedParent); - try { - $gapicClient->validateMessage($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function validateSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ValidateSchemaResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $schema = new Schema(); - $schemaName = 'schemaName-448762932'; - $schema->setName($schemaName); - $request = (new ValidateSchemaRequest()) - ->setParent($formattedParent) - ->setSchema($schema); - $response = $gapicClient->validateSchema($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/ValidateSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getSchema(); - $this->assertProtobufEquals($schema, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function validateSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $schema = new Schema(); - $schemaName = 'schemaName-448762932'; - $schema->setName($schemaName); - $request = (new ValidateSchemaRequest()) - ->setParent($formattedParent) - ->setSchema($schema); - try { - $gapicClient->validateSchema($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - $response = $gapicClient->getIamPolicy($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - try { - $gapicClient->getIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - $response = $gapicClient->setIamPolicy($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - try { - $gapicClient->setIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - $response = $gapicClient->testIamPermissions($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - try { - $gapicClient->testIamPermissions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function commitSchemaAsyncTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $definition = 'definition-1014418093'; - $revisionId = 'revisionId513861631'; - $expectedResponse = new Schema(); - $expectedResponse->setName($name2); - $expectedResponse->setDefinition($definition); - $expectedResponse->setRevisionId($revisionId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $schema = new Schema(); - $schemaName = 'schemaName-448762932'; - $schema->setName($schemaName); - $request = (new CommitSchemaRequest()) - ->setName($formattedName) - ->setSchema($schema); - $response = $gapicClient->commitSchemaAsync($request)->wait(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/CommitSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualRequestObject->getSchema(); - $this->assertProtobufEquals($schema, $actualValue); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SubscriberClientTest.php b/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SubscriberClientTest.php deleted file mode 100644 index cb8d2dee95a0..000000000000 --- a/owl-bot-staging/PubSub/v1/tests/Unit/V1/Client/SubscriberClientTest.php +++ /dev/null @@ -1,1494 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return SubscriberClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new SubscriberClient($options); - } - - /** @test */ - public function acknowledgeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $ackIds = []; - $request = (new AcknowledgeRequest()) - ->setSubscription($formattedSubscription) - ->setAckIds($ackIds); - $gapicClient->acknowledge($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/Acknowledge', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $actualValue = $actualRequestObject->getAckIds(); - $this->assertProtobufEquals($ackIds, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function acknowledgeExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $ackIds = []; - $request = (new AcknowledgeRequest()) - ->setSubscription($formattedSubscription) - ->setAckIds($ackIds); - try { - $gapicClient->acknowledge($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSnapshotTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $topic = 'topic110546223'; - $expectedResponse = new Snapshot(); - $expectedResponse->setName($name2); - $expectedResponse->setTopic($topic); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $request = (new CreateSnapshotRequest()) - ->setName($formattedName) - ->setSubscription($formattedSubscription); - $response = $gapicClient->createSnapshot($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/CreateSnapshot', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSnapshotExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $request = (new CreateSnapshotRequest()) - ->setName($formattedName) - ->setSubscription($formattedSubscription); - try { - $gapicClient->createSnapshot($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSubscriptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $topic2 = 'topic2-1139259102'; - $ackDeadlineSeconds2 = 921632575; - $retainAckedMessages2 = true; - $enableMessageOrdering2 = false; - $filter2 = 'filter2-721168085'; - $detached2 = false; - $enableExactlyOnceDelivery2 = true; - $expectedResponse = new Subscription(); - $expectedResponse->setName($name2); - $expectedResponse->setTopic($topic2); - $expectedResponse->setAckDeadlineSeconds($ackDeadlineSeconds2); - $expectedResponse->setRetainAckedMessages($retainAckedMessages2); - $expectedResponse->setEnableMessageOrdering($enableMessageOrdering2); - $expectedResponse->setFilter($filter2); - $expectedResponse->setDetached($detached2); - $expectedResponse->setEnableExactlyOnceDelivery($enableExactlyOnceDelivery2); - $transport->addResponse($expectedResponse); - // Mock request - $name = 'name3373707'; - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $request = (new Subscription()) - ->setName($name) - ->setTopic($formattedTopic); - $response = $gapicClient->createSubscription($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/CreateSubscription', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($formattedTopic, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSubscriptionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $name = 'name3373707'; - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $request = (new Subscription()) - ->setName($name) - ->setTopic($formattedTopic); - try { - $gapicClient->createSubscription($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSnapshotTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - $request = (new DeleteSnapshotRequest()) - ->setSnapshot($formattedSnapshot); - $gapicClient->deleteSnapshot($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/DeleteSnapshot', $actualFuncCall); - $actualValue = $actualRequestObject->getSnapshot(); - $this->assertProtobufEquals($formattedSnapshot, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSnapshotExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - $request = (new DeleteSnapshotRequest()) - ->setSnapshot($formattedSnapshot); - try { - $gapicClient->deleteSnapshot($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSubscriptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $request = (new DeleteSubscriptionRequest()) - ->setSubscription($formattedSubscription); - $gapicClient->deleteSubscription($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/DeleteSubscription', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSubscriptionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $request = (new DeleteSubscriptionRequest()) - ->setSubscription($formattedSubscription); - try { - $gapicClient->deleteSubscription($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSnapshotTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $topic = 'topic110546223'; - $expectedResponse = new Snapshot(); - $expectedResponse->setName($name); - $expectedResponse->setTopic($topic); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - $request = (new GetSnapshotRequest()) - ->setSnapshot($formattedSnapshot); - $response = $gapicClient->getSnapshot($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/GetSnapshot', $actualFuncCall); - $actualValue = $actualRequestObject->getSnapshot(); - $this->assertProtobufEquals($formattedSnapshot, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSnapshotExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - $request = (new GetSnapshotRequest()) - ->setSnapshot($formattedSnapshot); - try { - $gapicClient->getSnapshot($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSubscriptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $topic = 'topic110546223'; - $ackDeadlineSeconds = 2135351438; - $retainAckedMessages = false; - $enableMessageOrdering = true; - $filter = 'filter-1274492040'; - $detached = true; - $enableExactlyOnceDelivery = false; - $expectedResponse = new Subscription(); - $expectedResponse->setName($name); - $expectedResponse->setTopic($topic); - $expectedResponse->setAckDeadlineSeconds($ackDeadlineSeconds); - $expectedResponse->setRetainAckedMessages($retainAckedMessages); - $expectedResponse->setEnableMessageOrdering($enableMessageOrdering); - $expectedResponse->setFilter($filter); - $expectedResponse->setDetached($detached); - $expectedResponse->setEnableExactlyOnceDelivery($enableExactlyOnceDelivery); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $request = (new GetSubscriptionRequest()) - ->setSubscription($formattedSubscription); - $response = $gapicClient->getSubscription($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/GetSubscription', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSubscriptionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $request = (new GetSubscriptionRequest()) - ->setSubscription($formattedSubscription); - try { - $gapicClient->getSubscription($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSnapshotsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $snapshotsElement = new Snapshot(); - $snapshots = [ - $snapshotsElement, - ]; - $expectedResponse = new ListSnapshotsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSnapshots($snapshots); - $transport->addResponse($expectedResponse); - // Mock request - $formattedProject = $gapicClient->projectName('[PROJECT]'); - $request = (new ListSnapshotsRequest()) - ->setProject($formattedProject); - $response = $gapicClient->listSnapshots($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSnapshots()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/ListSnapshots', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($formattedProject, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSnapshotsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedProject = $gapicClient->projectName('[PROJECT]'); - $request = (new ListSnapshotsRequest()) - ->setProject($formattedProject); - try { - $gapicClient->listSnapshots($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSubscriptionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $subscriptionsElement = new Subscription(); - $subscriptions = [ - $subscriptionsElement, - ]; - $expectedResponse = new ListSubscriptionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSubscriptions($subscriptions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedProject = $gapicClient->projectName('[PROJECT]'); - $request = (new ListSubscriptionsRequest()) - ->setProject($formattedProject); - $response = $gapicClient->listSubscriptions($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSubscriptions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/ListSubscriptions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($formattedProject, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSubscriptionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedProject = $gapicClient->projectName('[PROJECT]'); - $request = (new ListSubscriptionsRequest()) - ->setProject($formattedProject); - try { - $gapicClient->listSubscriptions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function modifyAckDeadlineTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $ackIds = []; - $ackDeadlineSeconds = 2135351438; - $request = (new ModifyAckDeadlineRequest()) - ->setSubscription($formattedSubscription) - ->setAckIds($ackIds) - ->setAckDeadlineSeconds($ackDeadlineSeconds); - $gapicClient->modifyAckDeadline($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/ModifyAckDeadline', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $actualValue = $actualRequestObject->getAckIds(); - $this->assertProtobufEquals($ackIds, $actualValue); - $actualValue = $actualRequestObject->getAckDeadlineSeconds(); - $this->assertProtobufEquals($ackDeadlineSeconds, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function modifyAckDeadlineExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $ackIds = []; - $ackDeadlineSeconds = 2135351438; - $request = (new ModifyAckDeadlineRequest()) - ->setSubscription($formattedSubscription) - ->setAckIds($ackIds) - ->setAckDeadlineSeconds($ackDeadlineSeconds); - try { - $gapicClient->modifyAckDeadline($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function modifyPushConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $pushConfig = new PushConfig(); - $request = (new ModifyPushConfigRequest()) - ->setSubscription($formattedSubscription) - ->setPushConfig($pushConfig); - $gapicClient->modifyPushConfig($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/ModifyPushConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $actualValue = $actualRequestObject->getPushConfig(); - $this->assertProtobufEquals($pushConfig, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function modifyPushConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $pushConfig = new PushConfig(); - $request = (new ModifyPushConfigRequest()) - ->setSubscription($formattedSubscription) - ->setPushConfig($pushConfig); - try { - $gapicClient->modifyPushConfig($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function pullTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new PullResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $maxMessages = 496131527; - $request = (new PullRequest()) - ->setSubscription($formattedSubscription) - ->setMaxMessages($maxMessages); - $response = $gapicClient->pull($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/Pull', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $actualValue = $actualRequestObject->getMaxMessages(); - $this->assertProtobufEquals($maxMessages, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function pullExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $maxMessages = 496131527; - $request = (new PullRequest()) - ->setSubscription($formattedSubscription) - ->setMaxMessages($maxMessages); - try { - $gapicClient->pull($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function seekTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new SeekResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $request = (new SeekRequest()) - ->setSubscription($formattedSubscription); - $response = $gapicClient->seek($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/Seek', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function seekExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $request = (new SeekRequest()) - ->setSubscription($formattedSubscription); - try { - $gapicClient->seek($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingPullTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new StreamingPullResponse(); - $transport->addResponse($expectedResponse); - $expectedResponse2 = new StreamingPullResponse(); - $transport->addResponse($expectedResponse2); - $expectedResponse3 = new StreamingPullResponse(); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $streamAckDeadlineSeconds = 1875467245; - $request = new StreamingPullRequest(); - $request->setSubscription($formattedSubscription); - $request->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds); - $formattedSubscription2 = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $streamAckDeadlineSeconds2 = 1562238880; - $request2 = new StreamingPullRequest(); - $request2->setSubscription($formattedSubscription2); - $request2->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds2); - $formattedSubscription3 = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $streamAckDeadlineSeconds3 = 1562238879; - $request3 = new StreamingPullRequest(); - $request3->setSubscription($formattedSubscription3); - $request3->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds3); - $bidi = $gapicClient->streamingPull(); - $this->assertInstanceOf(BidiStream::class, $bidi); - $bidi->write($request); - $responses = []; - $responses[] = $bidi->read(); - $bidi->writeAll([ - $request2, - $request3, - ]); - foreach ($bidi->closeWriteAndReadAll() as $response) { - $responses[] = $response; - } - - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $createStreamRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($createStreamRequests)); - $streamFuncCall = $createStreamRequests[0]->getFuncCall(); - $streamRequestObject = $createStreamRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/StreamingPull', $streamFuncCall); - $this->assertNull($streamRequestObject); - $callObjects = $transport->popCallObjects(); - $this->assertSame(1, count($callObjects)); - $bidiCall = $callObjects[0]; - $writeRequests = $bidiCall->popReceivedCalls(); - $expectedRequests = []; - $expectedRequests[] = $request; - $expectedRequests[] = $request2; - $expectedRequests[] = $request3; - $this->assertEquals($expectedRequests, $writeRequests); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingPullExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - $bidi = $gapicClient->streamingPull(); - $results = $bidi->closeWriteAndReadAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSnapshotTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $topic = 'topic110546223'; - $expectedResponse = new Snapshot(); - $expectedResponse->setName($name); - $expectedResponse->setTopic($topic); - $transport->addResponse($expectedResponse); - // Mock request - $snapshot = new Snapshot(); - $updateMask = new FieldMask(); - $request = (new UpdateSnapshotRequest()) - ->setSnapshot($snapshot) - ->setUpdateMask($updateMask); - $response = $gapicClient->updateSnapshot($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/UpdateSnapshot', $actualFuncCall); - $actualValue = $actualRequestObject->getSnapshot(); - $this->assertProtobufEquals($snapshot, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSnapshotExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $snapshot = new Snapshot(); - $updateMask = new FieldMask(); - $request = (new UpdateSnapshotRequest()) - ->setSnapshot($snapshot) - ->setUpdateMask($updateMask); - try { - $gapicClient->updateSnapshot($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSubscriptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $topic = 'topic110546223'; - $ackDeadlineSeconds = 2135351438; - $retainAckedMessages = false; - $enableMessageOrdering = true; - $filter = 'filter-1274492040'; - $detached = true; - $enableExactlyOnceDelivery = false; - $expectedResponse = new Subscription(); - $expectedResponse->setName($name); - $expectedResponse->setTopic($topic); - $expectedResponse->setAckDeadlineSeconds($ackDeadlineSeconds); - $expectedResponse->setRetainAckedMessages($retainAckedMessages); - $expectedResponse->setEnableMessageOrdering($enableMessageOrdering); - $expectedResponse->setFilter($filter); - $expectedResponse->setDetached($detached); - $expectedResponse->setEnableExactlyOnceDelivery($enableExactlyOnceDelivery); - $transport->addResponse($expectedResponse); - // Mock request - $subscription = new Subscription(); - $subscriptionName = 'subscriptionName-515935928'; - $subscription->setName($subscriptionName); - $subscriptionTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $subscription->setTopic($subscriptionTopic); - $updateMask = new FieldMask(); - $request = (new UpdateSubscriptionRequest()) - ->setSubscription($subscription) - ->setUpdateMask($updateMask); - $response = $gapicClient->updateSubscription($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/UpdateSubscription', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($subscription, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSubscriptionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $subscription = new Subscription(); - $subscriptionName = 'subscriptionName-515935928'; - $subscription->setName($subscriptionName); - $subscriptionTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $subscription->setTopic($subscriptionTopic); - $updateMask = new FieldMask(); - $request = (new UpdateSubscriptionRequest()) - ->setSubscription($subscription) - ->setUpdateMask($updateMask); - try { - $gapicClient->updateSubscription($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - $response = $gapicClient->getIamPolicy($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - try { - $gapicClient->getIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - $response = $gapicClient->setIamPolicy($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - try { - $gapicClient->setIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - $response = $gapicClient->testIamPermissions($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - try { - $gapicClient->testIamPermissions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function acknowledgeAsyncTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $ackIds = []; - $request = (new AcknowledgeRequest()) - ->setSubscription($formattedSubscription) - ->setAckIds($ackIds); - $gapicClient->acknowledgeAsync($request)->wait(); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/Acknowledge', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $actualValue = $actualRequestObject->getAckIds(); - $this->assertProtobufEquals($ackIds, $actualValue); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/owl-bot-staging/PubSub/v1/tests/Unit/V1/PublisherClientTest.php b/owl-bot-staging/PubSub/v1/tests/Unit/V1/PublisherClientTest.php deleted file mode 100644 index 6995647cd719..000000000000 --- a/owl-bot-staging/PubSub/v1/tests/Unit/V1/PublisherClientTest.php +++ /dev/null @@ -1,841 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return PublisherClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new PublisherClient($options); - } - - /** @test */ - public function createTopicTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $kmsKeyName2 = 'kmsKeyName2-1057489140'; - $satisfiesPzs2 = true; - $expectedResponse = new Topic(); - $expectedResponse->setName($name2); - $expectedResponse->setKmsKeyName($kmsKeyName2); - $expectedResponse->setSatisfiesPzs($satisfiesPzs2); - $transport->addResponse($expectedResponse); - // Mock request - $name = 'name3373707'; - $response = $gapicClient->createTopic($name); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/CreateTopic', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTopicExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $name = 'name3373707'; - try { - $gapicClient->createTopic($name); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTopicTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $gapicClient->deleteTopic($formattedTopic); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/DeleteTopic', $actualFuncCall); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($formattedTopic, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTopicExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - try { - $gapicClient->deleteTopic($formattedTopic); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function detachSubscriptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new DetachSubscriptionResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $response = $gapicClient->detachSubscription($formattedSubscription); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/DetachSubscription', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function detachSubscriptionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - try { - $gapicClient->detachSubscription($formattedSubscription); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTopicTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $kmsKeyName = 'kmsKeyName2094986649'; - $satisfiesPzs = false; - $expectedResponse = new Topic(); - $expectedResponse->setName($name); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $response = $gapicClient->getTopic($formattedTopic); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/GetTopic', $actualFuncCall); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($formattedTopic, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTopicExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - try { - $gapicClient->getTopic($formattedTopic); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTopicSnapshotsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $snapshotsElement = 'snapshotsElement1339034092'; - $snapshots = [ - $snapshotsElement, - ]; - $expectedResponse = new ListTopicSnapshotsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSnapshots($snapshots); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $response = $gapicClient->listTopicSnapshots($formattedTopic); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSnapshots()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/ListTopicSnapshots', $actualFuncCall); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($formattedTopic, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTopicSnapshotsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - try { - $gapicClient->listTopicSnapshots($formattedTopic); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTopicSubscriptionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $subscriptionsElement = 'subscriptionsElement1698708147'; - $subscriptions = [ - $subscriptionsElement, - ]; - $expectedResponse = new ListTopicSubscriptionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSubscriptions($subscriptions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $response = $gapicClient->listTopicSubscriptions($formattedTopic); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSubscriptions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/ListTopicSubscriptions', $actualFuncCall); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($formattedTopic, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTopicSubscriptionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - try { - $gapicClient->listTopicSubscriptions($formattedTopic); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTopicsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $topicsElement = new Topic(); - $topics = [ - $topicsElement, - ]; - $expectedResponse = new ListTopicsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTopics($topics); - $transport->addResponse($expectedResponse); - // Mock request - $formattedProject = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->listTopics($formattedProject); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getTopics()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/ListTopics', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($formattedProject, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTopicsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedProject = $gapicClient->projectName('[PROJECT]'); - try { - $gapicClient->listTopics($formattedProject); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function publishTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new PublishResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $messages = []; - $response = $gapicClient->publish($formattedTopic, $messages); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/Publish', $actualFuncCall); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($formattedTopic, $actualValue); - $actualValue = $actualRequestObject->getMessages(); - $this->assertProtobufEquals($messages, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function publishExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $messages = []; - try { - $gapicClient->publish($formattedTopic, $messages); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTopicTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $kmsKeyName = 'kmsKeyName2094986649'; - $satisfiesPzs = false; - $expectedResponse = new Topic(); - $expectedResponse->setName($name); - $expectedResponse->setKmsKeyName($kmsKeyName); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $transport->addResponse($expectedResponse); - // Mock request - $topic = new Topic(); - $topicName = 'topicName388205658'; - $topic->setName($topicName); - $updateMask = new FieldMask(); - $response = $gapicClient->updateTopic($topic, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Publisher/UpdateTopic', $actualFuncCall); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($topic, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTopicExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $topic = new Topic(); - $topicName = 'topicName388205658'; - $topic->setName($topicName); - $updateMask = new FieldMask(); - try { - $gapicClient->updateTopic($topic, $updateMask); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/owl-bot-staging/PubSub/v1/tests/Unit/V1/SchemaServiceClientTest.php b/owl-bot-staging/PubSub/v1/tests/Unit/V1/SchemaServiceClientTest.php deleted file mode 100644 index 7247b4ae3319..000000000000 --- a/owl-bot-staging/PubSub/v1/tests/Unit/V1/SchemaServiceClientTest.php +++ /dev/null @@ -1,919 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return SchemaServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new SchemaServiceClient($options); - } - - /** @test */ - public function commitSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $definition = 'definition-1014418093'; - $revisionId = 'revisionId513861631'; - $expectedResponse = new Schema(); - $expectedResponse->setName($name2); - $expectedResponse->setDefinition($definition); - $expectedResponse->setRevisionId($revisionId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $schema = new Schema(); - $schemaName = 'schemaName-448762932'; - $schema->setName($schemaName); - $response = $gapicClient->commitSchema($formattedName, $schema); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/CommitSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualRequestObject->getSchema(); - $this->assertProtobufEquals($schema, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function commitSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $schema = new Schema(); - $schemaName = 'schemaName-448762932'; - $schema->setName($schemaName); - try { - $gapicClient->commitSchema($formattedName, $schema); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $definition = 'definition-1014418093'; - $revisionId = 'revisionId513861631'; - $expectedResponse = new Schema(); - $expectedResponse->setName($name); - $expectedResponse->setDefinition($definition); - $expectedResponse->setRevisionId($revisionId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $schema = new Schema(); - $schemaName = 'schemaName-448762932'; - $schema->setName($schemaName); - $response = $gapicClient->createSchema($formattedParent, $schema); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/CreateSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getSchema(); - $this->assertProtobufEquals($schema, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $schema = new Schema(); - $schemaName = 'schemaName-448762932'; - $schema->setName($schemaName); - try { - $gapicClient->createSchema($formattedParent, $schema); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $gapicClient->deleteSchema($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/DeleteSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - try { - $gapicClient->deleteSchema($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSchemaRevisionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $definition = 'definition-1014418093'; - $revisionId2 = 'revisionId2-100208654'; - $expectedResponse = new Schema(); - $expectedResponse->setName($name2); - $expectedResponse->setDefinition($definition); - $expectedResponse->setRevisionId($revisionId2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $revisionId = 'revisionId513861631'; - $response = $gapicClient->deleteSchemaRevision($formattedName, $revisionId); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/DeleteSchemaRevision', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualRequestObject->getRevisionId(); - $this->assertProtobufEquals($revisionId, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSchemaRevisionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $revisionId = 'revisionId513861631'; - try { - $gapicClient->deleteSchemaRevision($formattedName, $revisionId); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $definition = 'definition-1014418093'; - $revisionId = 'revisionId513861631'; - $expectedResponse = new Schema(); - $expectedResponse->setName($name2); - $expectedResponse->setDefinition($definition); - $expectedResponse->setRevisionId($revisionId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $response = $gapicClient->getSchema($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/GetSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - try { - $gapicClient->getSchema($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSchemaRevisionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $schemasElement = new Schema(); - $schemas = [ - $schemasElement, - ]; - $expectedResponse = new ListSchemaRevisionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSchemas($schemas); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $response = $gapicClient->listSchemaRevisions($formattedName); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSchemas()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/ListSchemaRevisions', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSchemaRevisionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - try { - $gapicClient->listSchemaRevisions($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSchemasTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $schemasElement = new Schema(); - $schemas = [ - $schemasElement, - ]; - $expectedResponse = new ListSchemasResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSchemas($schemas); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->listSchemas($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSchemas()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/ListSchemas', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSchemasExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - try { - $gapicClient->listSchemas($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function rollbackSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $definition = 'definition-1014418093'; - $revisionId2 = 'revisionId2-100208654'; - $expectedResponse = new Schema(); - $expectedResponse->setName($name2); - $expectedResponse->setDefinition($definition); - $expectedResponse->setRevisionId($revisionId2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $revisionId = 'revisionId513861631'; - $response = $gapicClient->rollbackSchema($formattedName, $revisionId); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/RollbackSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualRequestObject->getRevisionId(); - $this->assertProtobufEquals($revisionId, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function rollbackSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->schemaName('[PROJECT]', '[SCHEMA]'); - $revisionId = 'revisionId513861631'; - try { - $gapicClient->rollbackSchema($formattedName, $revisionId); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function validateMessageTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ValidateMessageResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->validateMessage($formattedParent); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/ValidateMessage', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function validateMessageExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - try { - $gapicClient->validateMessage($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function validateSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ValidateSchemaResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $schema = new Schema(); - $schemaName = 'schemaName-448762932'; - $schema->setName($schemaName); - $response = $gapicClient->validateSchema($formattedParent, $schema); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.SchemaService/ValidateSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getSchema(); - $this->assertProtobufEquals($schema, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function validateSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $schema = new Schema(); - $schemaName = 'schemaName-448762932'; - $schema->setName($schemaName); - try { - $gapicClient->validateSchema($formattedParent, $schema); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/owl-bot-staging/PubSub/v1/tests/Unit/V1/SubscriberClientTest.php b/owl-bot-staging/PubSub/v1/tests/Unit/V1/SubscriberClientTest.php deleted file mode 100644 index 10119fbd8aa9..000000000000 --- a/owl-bot-staging/PubSub/v1/tests/Unit/V1/SubscriberClientTest.php +++ /dev/null @@ -1,1353 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return SubscriberClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new SubscriberClient($options); - } - - /** @test */ - public function acknowledgeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $ackIds = []; - $gapicClient->acknowledge($formattedSubscription, $ackIds); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/Acknowledge', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $actualValue = $actualRequestObject->getAckIds(); - $this->assertProtobufEquals($ackIds, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function acknowledgeExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $ackIds = []; - try { - $gapicClient->acknowledge($formattedSubscription, $ackIds); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSnapshotTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $topic = 'topic110546223'; - $expectedResponse = new Snapshot(); - $expectedResponse->setName($name2); - $expectedResponse->setTopic($topic); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $response = $gapicClient->createSnapshot($formattedName, $formattedSubscription); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/CreateSnapshot', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSnapshotExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - try { - $gapicClient->createSnapshot($formattedName, $formattedSubscription); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSubscriptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $topic2 = 'topic2-1139259102'; - $ackDeadlineSeconds2 = 921632575; - $retainAckedMessages2 = true; - $enableMessageOrdering2 = false; - $filter2 = 'filter2-721168085'; - $detached2 = false; - $enableExactlyOnceDelivery2 = true; - $expectedResponse = new Subscription(); - $expectedResponse->setName($name2); - $expectedResponse->setTopic($topic2); - $expectedResponse->setAckDeadlineSeconds($ackDeadlineSeconds2); - $expectedResponse->setRetainAckedMessages($retainAckedMessages2); - $expectedResponse->setEnableMessageOrdering($enableMessageOrdering2); - $expectedResponse->setFilter($filter2); - $expectedResponse->setDetached($detached2); - $expectedResponse->setEnableExactlyOnceDelivery($enableExactlyOnceDelivery2); - $transport->addResponse($expectedResponse); - // Mock request - $name = 'name3373707'; - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $response = $gapicClient->createSubscription($name, $formattedTopic); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/CreateSubscription', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $actualValue = $actualRequestObject->getTopic(); - $this->assertProtobufEquals($formattedTopic, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSubscriptionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $name = 'name3373707'; - $formattedTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - try { - $gapicClient->createSubscription($name, $formattedTopic); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSnapshotTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - $gapicClient->deleteSnapshot($formattedSnapshot); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/DeleteSnapshot', $actualFuncCall); - $actualValue = $actualRequestObject->getSnapshot(); - $this->assertProtobufEquals($formattedSnapshot, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSnapshotExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - try { - $gapicClient->deleteSnapshot($formattedSnapshot); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSubscriptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $gapicClient->deleteSubscription($formattedSubscription); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/DeleteSubscription', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSubscriptionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - try { - $gapicClient->deleteSubscription($formattedSubscription); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSnapshotTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $topic = 'topic110546223'; - $expectedResponse = new Snapshot(); - $expectedResponse->setName($name); - $expectedResponse->setTopic($topic); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - $response = $gapicClient->getSnapshot($formattedSnapshot); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/GetSnapshot', $actualFuncCall); - $actualValue = $actualRequestObject->getSnapshot(); - $this->assertProtobufEquals($formattedSnapshot, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSnapshotExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSnapshot = $gapicClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); - try { - $gapicClient->getSnapshot($formattedSnapshot); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSubscriptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $topic = 'topic110546223'; - $ackDeadlineSeconds = 2135351438; - $retainAckedMessages = false; - $enableMessageOrdering = true; - $filter = 'filter-1274492040'; - $detached = true; - $enableExactlyOnceDelivery = false; - $expectedResponse = new Subscription(); - $expectedResponse->setName($name); - $expectedResponse->setTopic($topic); - $expectedResponse->setAckDeadlineSeconds($ackDeadlineSeconds); - $expectedResponse->setRetainAckedMessages($retainAckedMessages); - $expectedResponse->setEnableMessageOrdering($enableMessageOrdering); - $expectedResponse->setFilter($filter); - $expectedResponse->setDetached($detached); - $expectedResponse->setEnableExactlyOnceDelivery($enableExactlyOnceDelivery); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $response = $gapicClient->getSubscription($formattedSubscription); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/GetSubscription', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSubscriptionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - try { - $gapicClient->getSubscription($formattedSubscription); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSnapshotsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $snapshotsElement = new Snapshot(); - $snapshots = [ - $snapshotsElement, - ]; - $expectedResponse = new ListSnapshotsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSnapshots($snapshots); - $transport->addResponse($expectedResponse); - // Mock request - $formattedProject = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->listSnapshots($formattedProject); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSnapshots()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/ListSnapshots', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($formattedProject, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSnapshotsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedProject = $gapicClient->projectName('[PROJECT]'); - try { - $gapicClient->listSnapshots($formattedProject); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSubscriptionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $subscriptionsElement = new Subscription(); - $subscriptions = [ - $subscriptionsElement, - ]; - $expectedResponse = new ListSubscriptionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSubscriptions($subscriptions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedProject = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->listSubscriptions($formattedProject); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSubscriptions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/ListSubscriptions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($formattedProject, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSubscriptionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedProject = $gapicClient->projectName('[PROJECT]'); - try { - $gapicClient->listSubscriptions($formattedProject); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function modifyAckDeadlineTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $ackIds = []; - $ackDeadlineSeconds = 2135351438; - $gapicClient->modifyAckDeadline($formattedSubscription, $ackIds, $ackDeadlineSeconds); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/ModifyAckDeadline', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $actualValue = $actualRequestObject->getAckIds(); - $this->assertProtobufEquals($ackIds, $actualValue); - $actualValue = $actualRequestObject->getAckDeadlineSeconds(); - $this->assertProtobufEquals($ackDeadlineSeconds, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function modifyAckDeadlineExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $ackIds = []; - $ackDeadlineSeconds = 2135351438; - try { - $gapicClient->modifyAckDeadline($formattedSubscription, $ackIds, $ackDeadlineSeconds); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function modifyPushConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $pushConfig = new PushConfig(); - $gapicClient->modifyPushConfig($formattedSubscription, $pushConfig); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/ModifyPushConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $actualValue = $actualRequestObject->getPushConfig(); - $this->assertProtobufEquals($pushConfig, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function modifyPushConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $pushConfig = new PushConfig(); - try { - $gapicClient->modifyPushConfig($formattedSubscription, $pushConfig); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function pullTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new PullResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $maxMessages = 496131527; - $response = $gapicClient->pull($formattedSubscription, $maxMessages); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/Pull', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $actualValue = $actualRequestObject->getMaxMessages(); - $this->assertProtobufEquals($maxMessages, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function pullExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $maxMessages = 496131527; - try { - $gapicClient->pull($formattedSubscription, $maxMessages); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function seekTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new SeekResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $response = $gapicClient->seek($formattedSubscription); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/Seek', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($formattedSubscription, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function seekExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - try { - $gapicClient->seek($formattedSubscription); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingPullTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new StreamingPullResponse(); - $transport->addResponse($expectedResponse); - $expectedResponse2 = new StreamingPullResponse(); - $transport->addResponse($expectedResponse2); - $expectedResponse3 = new StreamingPullResponse(); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedSubscription = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $streamAckDeadlineSeconds = 1875467245; - $request = new StreamingPullRequest(); - $request->setSubscription($formattedSubscription); - $request->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds); - $formattedSubscription2 = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $streamAckDeadlineSeconds2 = 1562238880; - $request2 = new StreamingPullRequest(); - $request2->setSubscription($formattedSubscription2); - $request2->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds2); - $formattedSubscription3 = $gapicClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); - $streamAckDeadlineSeconds3 = 1562238879; - $request3 = new StreamingPullRequest(); - $request3->setSubscription($formattedSubscription3); - $request3->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds3); - $bidi = $gapicClient->streamingPull(); - $this->assertInstanceOf(BidiStream::class, $bidi); - $bidi->write($request); - $responses = []; - $responses[] = $bidi->read(); - $bidi->writeAll([ - $request2, - $request3, - ]); - foreach ($bidi->closeWriteAndReadAll() as $response) { - $responses[] = $response; - } - - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $createStreamRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($createStreamRequests)); - $streamFuncCall = $createStreamRequests[0]->getFuncCall(); - $streamRequestObject = $createStreamRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/StreamingPull', $streamFuncCall); - $this->assertNull($streamRequestObject); - $callObjects = $transport->popCallObjects(); - $this->assertSame(1, count($callObjects)); - $bidiCall = $callObjects[0]; - $writeRequests = $bidiCall->popReceivedCalls(); - $expectedRequests = []; - $expectedRequests[] = $request; - $expectedRequests[] = $request2; - $expectedRequests[] = $request3; - $this->assertEquals($expectedRequests, $writeRequests); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingPullExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - $bidi = $gapicClient->streamingPull(); - $results = $bidi->closeWriteAndReadAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSnapshotTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $topic = 'topic110546223'; - $expectedResponse = new Snapshot(); - $expectedResponse->setName($name); - $expectedResponse->setTopic($topic); - $transport->addResponse($expectedResponse); - // Mock request - $snapshot = new Snapshot(); - $updateMask = new FieldMask(); - $response = $gapicClient->updateSnapshot($snapshot, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/UpdateSnapshot', $actualFuncCall); - $actualValue = $actualRequestObject->getSnapshot(); - $this->assertProtobufEquals($snapshot, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSnapshotExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $snapshot = new Snapshot(); - $updateMask = new FieldMask(); - try { - $gapicClient->updateSnapshot($snapshot, $updateMask); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSubscriptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $topic = 'topic110546223'; - $ackDeadlineSeconds = 2135351438; - $retainAckedMessages = false; - $enableMessageOrdering = true; - $filter = 'filter-1274492040'; - $detached = true; - $enableExactlyOnceDelivery = false; - $expectedResponse = new Subscription(); - $expectedResponse->setName($name); - $expectedResponse->setTopic($topic); - $expectedResponse->setAckDeadlineSeconds($ackDeadlineSeconds); - $expectedResponse->setRetainAckedMessages($retainAckedMessages); - $expectedResponse->setEnableMessageOrdering($enableMessageOrdering); - $expectedResponse->setFilter($filter); - $expectedResponse->setDetached($detached); - $expectedResponse->setEnableExactlyOnceDelivery($enableExactlyOnceDelivery); - $transport->addResponse($expectedResponse); - // Mock request - $subscription = new Subscription(); - $subscriptionName = 'subscriptionName-515935928'; - $subscription->setName($subscriptionName); - $subscriptionTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $subscription->setTopic($subscriptionTopic); - $updateMask = new FieldMask(); - $response = $gapicClient->updateSubscription($subscription, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.pubsub.v1.Subscriber/UpdateSubscription', $actualFuncCall); - $actualValue = $actualRequestObject->getSubscription(); - $this->assertProtobufEquals($subscription, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSubscriptionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $subscription = new Subscription(); - $subscriptionName = 'subscriptionName-515935928'; - $subscription->setName($subscriptionName); - $subscriptionTopic = $gapicClient->topicName('[PROJECT]', '[TOPIC]'); - $subscription->setTopic($subscriptionTopic); - $updateMask = new FieldMask(); - try { - $gapicClient->updateSubscription($subscription, $updateMask); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -}