Skip to content

Commit 9aafea6

Browse files
committed
chore(pubsub): white space changes and column restriction to 80
1 parent da2e01c commit 9aafea6

13 files changed

+83
-57
lines changed

google-cloud-pubsub/samples/pubsub_commit_avro_schema.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,17 @@ def commit_avro_schema schema_id:, avsc_file:
2020
# avsc_file = "path/to/a/avsc_file.avsc"
2121

2222
pubsub = Google::Cloud::Pubsub.new
23-
2423
schemas = pubsub.schemas
2524

2625
schema = schemas.get_schema name: pubsub.schema_path(schema_id)
2726

2827
definition = File.read avsc_file
29-
3028
schema.definition = definition
3129

3230
result = schemas.commit_schema name: schema.name,
3331
schema: schema
3432

3533
puts "Schema commited with revision #{result.revision_id}."
36-
result
3734
# [END pubsub_commit_avro_schema]
35+
result
3836
end

google-cloud-pubsub/samples/pubsub_create_proto_schema.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ def create_proto_schema schema_id:, proto_file:
2020
# proto_file = "path/to/a/proto/file/(.proto)/formatted/in/protocol/buffers"
2121

2222
pubsub = Google::Cloud::PubSub.new
23+
schemas = pubsub.schemas
2324

2425
definition = File.read proto_file
2526
schema = Google::Cloud::PubSub::V1::Schema.new name: schema_id,
2627
type: :PROTOCOL_BUFFER,
2728
definition: definition
2829

29-
schemas = pubsub.schemas
30-
3130
schema = schemas.create_schema parent: pubsub.project_path,
3231
schema: schema,
3332
schema_id: schema_id

google-cloud-pubsub/samples/pubsub_create_topic_with_aws_msk_ingestion.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@
1414

1515
require "google/cloud/pubsub"
1616

17-
def create_topic_with_aws_msk_ingestion topic_id:, cluster_arn:, msk_topic:, aws_role_arn:, gcp_service_account:
17+
def create_topic_with_aws_msk_ingestion topic_id:,
18+
cluster_arn:,
19+
msk_topic:,
20+
aws_role_arn:,
21+
gcp_service_account:
1822
# [START pubsub_create_topic_with_aws_msk_ingestion]
1923
# topic_id = "your-topic-id"
20-
# cluster_arn = "arn:aws:kafka:us-east-1:111111111111:cluster/cluster-name/11111111-1111-1"
24+
# cluster_arn = "arn:aws:kafka:us-east-1:111111111111:" \
25+
# "cluster/cluster-name/11111111-1111-1"
2126
# msk_topic = "msk-topic-name"
2227
# aws_role_arn = "arn:aws:iam::111111111111:role/role-name"
2328
# gcp_service_account = "[email protected]"
2429
pubsub = Google::Cloud::Pubsub.new
25-
2630
topic_admin = pubsub.topic_admin
2731

2832
topic = topic_admin.create_topic name: pubsub.topic_path(topic_id),

google-cloud-pubsub/samples/pubsub_create_topic_with_azure_event_hubs_ingestion.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@
1414

1515
require "google/cloud/pubsub"
1616

17-
def create_topic_with_azure_event_hubs_ingestion topic_id:, resource_group:, namespace:, event_hub:, client_id:,
18-
tenant_id:, subscription_id:, gcp_service_account:
17+
def create_topic_with_azure_event_hubs_ingestion topic_id:,
18+
resource_group:,
19+
namespace:,
20+
event_hub:,
21+
client_id:,
22+
tenant_id:,
23+
subscription_id:,
24+
gcp_service_account:
1925
# [START pubsub_create_topic_with_azure_event_hubs_ingestion]
2026
# topic_id = "your-topic-id"
2127
# resource_group = "resource-group"

google-cloud-pubsub/samples/pubsub_create_topic_with_cloud_storage_ingestion.rb

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414

1515
require "google/cloud/pubsub"
1616

17-
def create_topic_with_cloud_storage_ingestion topic_id:, bucket:, input_format:, text_delimiter:, match_glob:,
17+
def create_topic_with_cloud_storage_ingestion topic_id:,
18+
bucket:,
19+
input_format:,
20+
text_delimiter:,
21+
match_glob:,
1822
minimum_object_create_time:
1923
# [START pubsub_create_topic_with_cloud_storage_ingestion]
2024
# topic_id = "your-topic-id"
@@ -24,33 +28,34 @@ def create_topic_with_cloud_storage_ingestion topic_id:, bucket:, input_format:,
2428
# match_glob = "**.txt"
2529
# minimum_object_create_time = Google::Protobuf::Timestamp.new
2630
pubsub = Google::Cloud::Pubsub.new
27-
2831
topic_admin = pubsub.topic_admin
29-
3032
cloud_storage =
31-
Google::Cloud::PubSub::V1::IngestionDataSourceSettings::CloudStorage.new bucket: bucket,
32-
minimum_object_create_time:
33-
minimum_object_create_time
33+
Google::Cloud::PubSub::V1::IngestionDataSourceSettings::CloudStorage
34+
35+
settings = cloud_storage.new \
36+
bucket: bucket,
37+
minimum_object_create_time: minimum_object_create_time
3438

3539
case input_format
3640
when "text"
37-
cloud_storage.text_format =
38-
Google::Cloud::PubSub::V1::IngestionDataSourceSettings::CloudStorage::TextFormat.new delimiter: text_delimiter
41+
settings.text_format = cloud_storage::TextFormat.new \
42+
delimiter: text_delimiter
3943
when "avro"
40-
cloud_storage.avro_format = Google::Cloud::PubSub::V1::IngestionDataSourceSettings::CloudStorage::AvroFormat.new
44+
settings.avro_format = cloud_storage::AvroFormat.new
4145
when "pubsub_avro"
42-
cloud_storage.pubsub_avro_format = Google::Cloud::PubSub::V1::IngestionDataSourceSettings::CloudStorage::PubSubAvroFormat.new
46+
settings.pubsub_avro_format = cloud_storage::PubSubAvroFormat.new
4347
else
44-
raise "input_format must be in ('text', 'avro', 'pubsub_avro'); got value: #{input_format}"
48+
raise "input_format must be in ('text', 'avro', 'pubsub_avro');" \
49+
"got value: #{input_format}"
4550
end
4651

4752
if !match_glob.nil? && !match_glob.empty?
48-
cloud_storage.match_glob = match_glob
53+
settings.match_glob = match_glob
4954
end
5055

5156
topic = topic_admin.create_topic name: pubsub.topic_path(topic_id),
5257
ingestion_data_source_settings: {
53-
cloud_storage: cloud_storage
58+
cloud_storage: settings
5459
}
5560

5661
puts "Topic with Cloud Storage Ingestion #{topic.name} created."

google-cloud-pubsub/samples/pubsub_create_topic_with_confluent_cloud_ingestion.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@
1414

1515
require "google/cloud/pubsub"
1616

17-
def create_topic_with_confluent_cloud_ingestion topic_id:, bootstrap_server:, cluster_id:, confluent_topic:,
18-
identity_pool_id:, gcp_service_account:
17+
def create_topic_with_confluent_cloud_ingestion topic_id:,
18+
bootstrap_server:,
19+
cluster_id:,
20+
confluent_topic:,
21+
identity_pool_id:,
22+
gcp_service_account:
1923
# [START pubsub_create_topic_with_confluent_cloud_ingestion]
2024
# topic_id = "your-topic-id"
2125
# bootstrap_server = "bootstrap-server-id.us-south1.gcp.confluent.cloud:9092"
@@ -24,7 +28,6 @@ def create_topic_with_confluent_cloud_ingestion topic_id:, bootstrap_server:, cl
2428
# identity_pool_id = "identity-pool-id"
2529
# gcp_service_account = "[email protected]"
2630
pubsub = Google::Cloud::Pubsub.new
27-
2831
topic_admin = pubsub.topic_admin
2932

3033
topic = topic_admin.create_topic name: pubsub.topic_path(topic_id),

google-cloud-pubsub/samples/pubsub_create_topic_with_kinesis_ingestion.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@
1414

1515
require "google/cloud/pubsub"
1616

17-
def create_topic_with_kinesis_ingestion topic_id:, stream_arn:, consumer_arn:, aws_role_arn:, gcp_service_account:
17+
def create_topic_with_kinesis_ingestion topic_id:,
18+
stream_arn:,
19+
consumer_arn:,
20+
aws_role_arn:,
21+
gcp_service_account:
1822
# [START pubsub_create_topic_with_kinesis_ingestion]
1923
# topic_id = "your-topic-id"
2024
# stream_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/stream-name"
21-
# consumer_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/stream-name/consumer/consumer-1:1111111111"
25+
# consumer_arn = "arn:aws:kinesis:us-west-2:111111111111:" \
26+
# "stream/stream-name/consumer/consumer-1:1111111111"
2227
# aws_role_arn = "arn:aws:iam::111111111111:role/role-name"
2328
# gcp_service_account = "[email protected]"
2429
pubsub = Google::Cloud::Pubsub.new
25-
2630
topic_admin = pubsub.topic_admin
2731

2832
topic = topic_admin.create_topic name: pubsub.topic_path(topic_id),

google-cloud-pubsub/samples/pubsub_create_unwrapped_push_subscription.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ def create_unwrapped_push_subscription topic_id:, subscription_id:, endpoint:
2121
# endpoint = "https://your-test-project.appspot.com/push"
2222

2323
pubsub = Google::Cloud::Pubsub.new
24-
2524
subscription_admin = pubsub.subscription_admin
2625

27-
subscription = subscription_admin.create_subscription name: pubsub.subscription_path(subscription_id),
28-
topic: pubsub.topic_path(topic_id),
29-
push_config: {
30-
push_endpoint: endpoint,
31-
no_wrapper: {
32-
write_metadata: true
33-
}
34-
}
26+
subscription = subscription_admin.create_subscription \
27+
name: pubsub.subscription_path(subscription_id),
28+
topic: pubsub.topic_path(topic_id),
29+
push_config: {
30+
push_endpoint: endpoint,
31+
no_wrapper: {
32+
write_metadata: true
33+
}
34+
}
3535

3636
puts "Unwrapped push subscription #{subscription_id} created."
3737
# [END pubsub_create_unwrapped_push_subscription]

google-cloud-pubsub/samples/pubsub_delete_schema_revision.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ def delete_schema_revision schema_id:, revision_id:
2020
# revision_id = "your-revision-id"
2121

2222
pubsub = Google::Cloud::Pubsub.new
23-
2423
schemas = pubsub.schemas
2524

26-
result = schemas.delete_schema_revision name: pubsub.schema_path("#{schema_id}@#{revision_id}")
25+
result = schemas.delete_schema_revision \
26+
name: pubsub.schema_path("#{schema_id}@#{revision_id}")
2727

2828
puts "Schema #{schema_id}@#{revision_id} deleted."
2929
# [END pubsub_delete_schema_revision]

google-cloud-pubsub/samples/pubsub_get_schema_revision.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ def get_schema_revision schema_id:, revision_id:
2020
# revision_id = "your-revision-id"
2121

2222
pubsub = Google::Cloud::Pubsub.new
23-
2423
schemas = pubsub.schemas
2524

26-
schema = schemas.get_schema name: pubsub.schema_path("#{schema_id}@#{revision_id}")
25+
schema = schemas.get_schema \
26+
name: pubsub.schema_path("#{schema_id}@#{revision_id}")
2727

2828
puts "Schema #{schema.name} retrieved."
2929
# [END pubsub_get_schema_revision]

0 commit comments

Comments
 (0)