google-cloud-build-v1 0.4.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8ae8afcf0aba7fb3d2e94b74e95174c6fc79fd075f56e1bc09e2399b724819e
4
- data.tar.gz: 5e346d486d0cd3dd27e3b1047b7488df7fee7e48cbb475b283eb5fcba96ce8c2
3
+ metadata.gz: 9fd56485a3fdc9f9215f05e1d3635fb10f2ad27f8899f35170daeb98d0f26fae
4
+ data.tar.gz: f8b547de79d4f2a7a7ef0d8d8af57623e32b434c8d225dc4c8d2bf9e838e8943
5
5
  SHA512:
6
- metadata.gz: 4c933089c27f86dab0dcaa2baabc5a5b83dce041ccdd4a5b95f78ac2277674618e353e28433a4593aae163b9516051f96f202c8df67ec201ed31875a07a56bf7
7
- data.tar.gz: abdbc0dc7f27e77211896e02d4e424d08c69cd9ff66f63db31861d1eeb5a4009a23596ae10d2c965e9903c137c5b13f4f4eb0bf7cac52afd3ae2ea6f90e05cea
6
+ metadata.gz: e3173ebb82d6622a541e3bed982214c872637505a368b38928cc791d90eb6f6faedd8f936c26a0864ad0dc116408e857f82d5a347af505b1bd7bb072ed67bc4a
7
+ data.tar.gz: ffe588eee00a5e7e65b4743da9afa681c40f09a68230694441834a9a45febfedc25c31d3ee28f6d078de4dd45430f7733ccb34bb63edc90ccaef45c76f7b1e7d
data/AUTHENTICATION.md CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-build-v1
66
66
  checks for credentials are configured on the service Credentials class (such as
67
67
  {::Google::Cloud::Build::V1::CloudBuild::Credentials}):
68
68
 
69
- 1. `CLOUD_BUILD_CREDENTIALS` - Path to JSON file, or JSON contents
70
- 2. `CLOUD_BUILD_KEYFILE` - Path to JSON file, or JSON contents
71
- 3. `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
72
- 4. `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
73
- 5. `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
69
+ * `CLOUD_BUILD_CREDENTIALS` - Path to JSON file, or JSON contents
70
+ * `CLOUD_BUILD_KEYFILE` - Path to JSON file, or JSON contents
71
+ * `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
72
+ * `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
73
+ * `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
74
74
 
75
75
  ```ruby
76
76
  require "google/cloud/build/v1"
data/README.md CHANGED
@@ -33,7 +33,7 @@ In order to use this library, you first need to go through the following steps:
33
33
  require "google/cloud/build/v1"
34
34
 
35
35
  client = ::Google::Cloud::Build::V1::CloudBuild::Client.new
36
- request = my_create_request
36
+ request = ::Google::Cloud::Build::V1::CreateBuildRequest.new # (request fields as keyword arguments...)
37
37
  response = client.create_build request
38
38
  ```
39
39
 
@@ -76,18 +76,12 @@ module Google
76
76
 
77
77
  default_config.rpcs.get_build.timeout = 600.0
78
78
  default_config.rpcs.get_build.retry_policy = {
79
- initial_delay: 0.1,
80
- max_delay: 60.0,
81
- multiplier: 1.3,
82
- retry_codes: [14, 4]
79
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
83
80
  }
84
81
 
85
82
  default_config.rpcs.list_builds.timeout = 600.0
86
83
  default_config.rpcs.list_builds.retry_policy = {
87
- initial_delay: 0.1,
88
- max_delay: 60.0,
89
- multiplier: 1.3,
90
- retry_codes: [14, 4]
84
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
91
85
  }
92
86
 
93
87
  default_config.rpcs.cancel_build.timeout = 600.0
@@ -98,26 +92,17 @@ module Google
98
92
 
99
93
  default_config.rpcs.get_build_trigger.timeout = 600.0
100
94
  default_config.rpcs.get_build_trigger.retry_policy = {
101
- initial_delay: 0.1,
102
- max_delay: 60.0,
103
- multiplier: 1.3,
104
- retry_codes: [14, 4]
95
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
105
96
  }
106
97
 
107
98
  default_config.rpcs.list_build_triggers.timeout = 600.0
108
99
  default_config.rpcs.list_build_triggers.retry_policy = {
109
- initial_delay: 0.1,
110
- max_delay: 60.0,
111
- multiplier: 1.3,
112
- retry_codes: [14, 4]
100
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
113
101
  }
114
102
 
115
103
  default_config.rpcs.delete_build_trigger.timeout = 600.0
116
104
  default_config.rpcs.delete_build_trigger.retry_policy = {
117
- initial_delay: 0.1,
118
- max_delay: 60.0,
119
- multiplier: 1.3,
120
- retry_codes: [14, 4]
105
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
121
106
  }
122
107
 
123
108
  default_config.rpcs.update_build_trigger.timeout = 600.0
@@ -128,10 +113,7 @@ module Google
128
113
 
129
114
  default_config.rpcs.get_worker_pool.timeout = 600.0
130
115
  default_config.rpcs.get_worker_pool.retry_policy = {
131
- initial_delay: 0.1,
132
- max_delay: 60.0,
133
- multiplier: 1.3,
134
- retry_codes: [14, 4]
116
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
135
117
  }
136
118
 
137
119
  default_config.rpcs.delete_worker_pool.timeout = 600.0
@@ -140,10 +122,7 @@ module Google
140
122
 
141
123
  default_config.rpcs.list_worker_pools.timeout = 600.0
142
124
  default_config.rpcs.list_worker_pools.retry_policy = {
143
- initial_delay: 0.1,
144
- max_delay: 60.0,
145
- multiplier: 1.3,
146
- retry_codes: [14, 4]
125
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
147
126
  }
148
127
 
149
128
  default_config
@@ -214,7 +193,7 @@ module Google
214
193
  !@config.endpoint.split(".").first.include?("-")
215
194
  credentials ||= Credentials.default scope: @config.scope,
216
195
  enable_self_signed_jwt: enable_self_signed_jwt
217
- if credentials.is_a?(String) || credentials.is_a?(Hash)
196
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
218
197
  credentials = Credentials.new credentials, scope: @config.scope
219
198
  end
220
199
  @quota_project_id = @config.quota_project
@@ -423,7 +402,15 @@ module Google
423
402
  # @param page_size [::Integer]
424
403
  # Number of results to return in the list.
425
404
  # @param page_token [::String]
426
- # Token to provide to skip to a particular spot in the list.
405
+ # The page token for the next page of Builds.
406
+ #
407
+ # If unspecified, the first page of results is returned.
408
+ #
409
+ # If the token is rejected for any reason, INVALID_ARGUMENT will be thrown.
410
+ # In this case, the token should be discarded, and pagination should be
411
+ # restarted from the first page of results.
412
+ #
413
+ # See https://google.aip.dev/158 for more.
427
414
  # @param filter [::String]
428
415
  # The raw filter text to constrain the results.
429
416
  #
@@ -492,7 +479,7 @@ module Google
492
479
  # the default parameter values, pass an empty Hash as a request object (see above).
493
480
  #
494
481
  # @param name [::String]
495
- # The name of the `Build` to retrieve.
482
+ # The name of the `Build` to cancel.
496
483
  # Format: `projects/{project}/locations/{location}/builds/{build}`
497
484
  # @param project_id [::String]
498
485
  # Required. ID of the project.
@@ -659,11 +646,14 @@ module Google
659
646
  # @param options [::Gapic::CallOptions, ::Hash]
660
647
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
661
648
  #
662
- # @overload create_build_trigger(project_id: nil, trigger: nil)
649
+ # @overload create_build_trigger(parent: nil, project_id: nil, trigger: nil)
663
650
  # Pass arguments to `create_build_trigger` via keyword arguments. Note that at
664
651
  # least one keyword argument is required. To specify no parameters, or to keep all
665
652
  # the default parameter values, pass an empty Hash as a request object (see above).
666
653
  #
654
+ # @param parent [::String]
655
+ # The parent resource where this trigger will be created.
656
+ # Format: `projects/{project}/locations/{location}`
667
657
  # @param project_id [::String]
668
658
  # Required. ID of the project for which to configure automatic builds.
669
659
  # @param trigger [::Google::Cloud::Build::V1::BuildTrigger, ::Hash]
@@ -729,11 +719,14 @@ module Google
729
719
  # @param options [::Gapic::CallOptions, ::Hash]
730
720
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
731
721
  #
732
- # @overload get_build_trigger(project_id: nil, trigger_id: nil)
722
+ # @overload get_build_trigger(name: nil, project_id: nil, trigger_id: nil)
733
723
  # Pass arguments to `get_build_trigger` via keyword arguments. Note that at
734
724
  # least one keyword argument is required. To specify no parameters, or to keep all
735
725
  # the default parameter values, pass an empty Hash as a request object (see above).
736
726
  #
727
+ # @param name [::String]
728
+ # The name of the `Trigger` to retrieve.
729
+ # Format: `projects/{project}/locations/{location}/triggers/{trigger}`
737
730
  # @param project_id [::String]
738
731
  # Required. ID of the project that owns the trigger.
739
732
  # @param trigger_id [::String]
@@ -800,11 +793,14 @@ module Google
800
793
  # @param options [::Gapic::CallOptions, ::Hash]
801
794
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
802
795
  #
803
- # @overload list_build_triggers(project_id: nil, page_size: nil, page_token: nil)
796
+ # @overload list_build_triggers(parent: nil, project_id: nil, page_size: nil, page_token: nil)
804
797
  # Pass arguments to `list_build_triggers` via keyword arguments. Note that at
805
798
  # least one keyword argument is required. To specify no parameters, or to keep all
806
799
  # the default parameter values, pass an empty Hash as a request object (see above).
807
800
  #
801
+ # @param parent [::String]
802
+ # The parent of the collection of `Triggers`.
803
+ # Format: `projects/{project}/locations/{location}`
808
804
  # @param project_id [::String]
809
805
  # Required. ID of the project for which to list BuildTriggers.
810
806
  # @param page_size [::Integer]
@@ -873,11 +869,14 @@ module Google
873
869
  # @param options [::Gapic::CallOptions, ::Hash]
874
870
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
875
871
  #
876
- # @overload delete_build_trigger(project_id: nil, trigger_id: nil)
872
+ # @overload delete_build_trigger(name: nil, project_id: nil, trigger_id: nil)
877
873
  # Pass arguments to `delete_build_trigger` via keyword arguments. Note that at
878
874
  # least one keyword argument is required. To specify no parameters, or to keep all
879
875
  # the default parameter values, pass an empty Hash as a request object (see above).
880
876
  #
877
+ # @param name [::String]
878
+ # The name of the `Trigger` to delete.
879
+ # Format: `projects/{project}/locations/{location}/triggers/{trigger}`
881
880
  # @param project_id [::String]
882
881
  # Required. ID of the project that owns the trigger.
883
882
  # @param trigger_id [::String]
@@ -1015,17 +1014,20 @@ module Google
1015
1014
  # @param options [::Gapic::CallOptions, ::Hash]
1016
1015
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1017
1016
  #
1018
- # @overload run_build_trigger(project_id: nil, trigger_id: nil, source: nil)
1017
+ # @overload run_build_trigger(name: nil, project_id: nil, trigger_id: nil, source: nil)
1019
1018
  # Pass arguments to `run_build_trigger` via keyword arguments. Note that at
1020
1019
  # least one keyword argument is required. To specify no parameters, or to keep all
1021
1020
  # the default parameter values, pass an empty Hash as a request object (see above).
1022
1021
  #
1022
+ # @param name [::String]
1023
+ # The name of the `Trigger` to run.
1024
+ # Format: `projects/{project}/locations/{location}/triggers/{trigger}`
1023
1025
  # @param project_id [::String]
1024
1026
  # Required. ID of the project.
1025
1027
  # @param trigger_id [::String]
1026
1028
  # Required. ID of the trigger.
1027
1029
  # @param source [::Google::Cloud::Build::V1::RepoSource, ::Hash]
1028
- # Required. Source to build against this trigger.
1030
+ # Source to build against this trigger.
1029
1031
  #
1030
1032
  # @yield [response, operation] Access the result along with the RPC operation
1031
1033
  # @yieldparam response [::Gapic::Operation]
@@ -1074,6 +1076,83 @@ module Google
1074
1076
  raise ::Google::Cloud::Error.from_error(e)
1075
1077
  end
1076
1078
 
1079
+ ##
1080
+ # ReceiveTriggerWebhook [Experimental] is called when the API receives a
1081
+ # webhook request targeted at a specific trigger.
1082
+ #
1083
+ # @overload receive_trigger_webhook(request, options = nil)
1084
+ # Pass arguments to `receive_trigger_webhook` via a request object, either of type
1085
+ # {::Google::Cloud::Build::V1::ReceiveTriggerWebhookRequest} or an equivalent Hash.
1086
+ #
1087
+ # @param request [::Google::Cloud::Build::V1::ReceiveTriggerWebhookRequest, ::Hash]
1088
+ # A request object representing the call parameters. Required. To specify no
1089
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1090
+ # @param options [::Gapic::CallOptions, ::Hash]
1091
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1092
+ #
1093
+ # @overload receive_trigger_webhook(name: nil, body: nil, project_id: nil, trigger: nil, secret: nil)
1094
+ # Pass arguments to `receive_trigger_webhook` via keyword arguments. Note that at
1095
+ # least one keyword argument is required. To specify no parameters, or to keep all
1096
+ # the default parameter values, pass an empty Hash as a request object (see above).
1097
+ #
1098
+ # @param name [::String]
1099
+ # The name of the `ReceiveTriggerWebhook` to retrieve.
1100
+ # Format: `projects/{project}/locations/{location}/triggers/{trigger}`
1101
+ # @param body [::Google::Api::HttpBody, ::Hash]
1102
+ # HTTP request body.
1103
+ # @param project_id [::String]
1104
+ # Project in which the specified trigger lives
1105
+ # @param trigger [::String]
1106
+ # Name of the trigger to run the payload against
1107
+ # @param secret [::String]
1108
+ # Secret token used for authorization if an OAuth token isn't provided.
1109
+ #
1110
+ # @yield [response, operation] Access the result along with the RPC operation
1111
+ # @yieldparam response [::Google::Cloud::Build::V1::ReceiveTriggerWebhookResponse]
1112
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1113
+ #
1114
+ # @return [::Google::Cloud::Build::V1::ReceiveTriggerWebhookResponse]
1115
+ #
1116
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1117
+ #
1118
+ def receive_trigger_webhook request, options = nil
1119
+ raise ::ArgumentError, "request must be provided" if request.nil?
1120
+
1121
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::ReceiveTriggerWebhookRequest
1122
+
1123
+ # Converts hash and nil to an options object
1124
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1125
+
1126
+ # Customize the options with defaults
1127
+ metadata = @config.rpcs.receive_trigger_webhook.metadata.to_h
1128
+
1129
+ # Set x-goog-api-client and x-goog-user-project headers
1130
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1131
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1132
+ gapic_version: ::Google::Cloud::Build::V1::VERSION
1133
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1134
+
1135
+ header_params = {
1136
+ "project_id" => request.project_id,
1137
+ "trigger" => request.trigger
1138
+ }
1139
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1140
+ metadata[:"x-goog-request-params"] ||= request_params_header
1141
+
1142
+ options.apply_defaults timeout: @config.rpcs.receive_trigger_webhook.timeout,
1143
+ metadata: metadata,
1144
+ retry_policy: @config.rpcs.receive_trigger_webhook.retry_policy
1145
+ options.apply_defaults metadata: @config.metadata,
1146
+ retry_policy: @config.retry_policy
1147
+
1148
+ @cloud_build_stub.call_rpc :receive_trigger_webhook, request, options: options do |response, operation|
1149
+ yield response, operation if block_given?
1150
+ return response
1151
+ end
1152
+ rescue ::GRPC::BadStatus => e
1153
+ raise ::Google::Cloud::Error.from_error(e)
1154
+ end
1155
+
1077
1156
  ##
1078
1157
  # Creates a `WorkerPool` to run the builds, and returns the new worker pool.
1079
1158
  #
@@ -1583,6 +1662,11 @@ module Google
1583
1662
  #
1584
1663
  attr_reader :run_build_trigger
1585
1664
  ##
1665
+ # RPC-specific configuration for `receive_trigger_webhook`
1666
+ # @return [::Gapic::Config::Method]
1667
+ #
1668
+ attr_reader :receive_trigger_webhook
1669
+ ##
1586
1670
  # RPC-specific configuration for `create_worker_pool`
1587
1671
  # @return [::Gapic::Config::Method]
1588
1672
  #
@@ -1632,6 +1716,8 @@ module Google
1632
1716
  @update_build_trigger = ::Gapic::Config::Method.new update_build_trigger_config
1633
1717
  run_build_trigger_config = parent_rpcs.run_build_trigger if parent_rpcs.respond_to? :run_build_trigger
1634
1718
  @run_build_trigger = ::Gapic::Config::Method.new run_build_trigger_config
1719
+ receive_trigger_webhook_config = parent_rpcs.receive_trigger_webhook if parent_rpcs.respond_to? :receive_trigger_webhook
1720
+ @receive_trigger_webhook = ::Gapic::Config::Method.new receive_trigger_webhook_config
1635
1721
  create_worker_pool_config = parent_rpcs.create_worker_pool if parent_rpcs.respond_to? :create_worker_pool
1636
1722
  @create_worker_pool = ::Gapic::Config::Method.new create_worker_pool_config
1637
1723
  get_worker_pool_config = parent_rpcs.get_worker_pool if parent_rpcs.respond_to? :get_worker_pool
@@ -82,7 +82,7 @@ module Google
82
82
  # Create credentials
83
83
  credentials = @config.credentials
84
84
  credentials ||= Credentials.default scope: @config.scope
85
- if credentials.is_a?(String) || credentials.is_a?(Hash)
85
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
86
86
  credentials = Credentials.new credentials, scope: @config.scope
87
87
  end
88
88
  @quota_project_id = @config.quota_project
@@ -68,18 +68,63 @@ module Google
68
68
  ##
69
69
  # Create a fully-qualified BuildTrigger resource string.
70
70
  #
71
+ # @overload build_trigger_path(project:, trigger:)
72
+ # The resource will be in the following format:
73
+ #
74
+ # `projects/{project}/triggers/{trigger}`
75
+ #
76
+ # @param project [String]
77
+ # @param trigger [String]
78
+ #
79
+ # @overload build_trigger_path(project:, location:, trigger:)
80
+ # The resource will be in the following format:
81
+ #
82
+ # `projects/{project}/locations/{location}/triggers/{trigger}`
83
+ #
84
+ # @param project [String]
85
+ # @param location [String]
86
+ # @param trigger [String]
87
+ #
88
+ # @return [::String]
89
+ def build_trigger_path **args
90
+ resources = {
91
+ "project:trigger" => (proc do |project:, trigger:|
92
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
93
+
94
+ "projects/#{project}/triggers/#{trigger}"
95
+ end),
96
+ "location:project:trigger" => (proc do |project:, location:, trigger:|
97
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
98
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
99
+
100
+ "projects/#{project}/locations/#{location}/triggers/#{trigger}"
101
+ end)
102
+ }
103
+
104
+ resource = resources[args.keys.sort.join(":")]
105
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
106
+ resource.call(**args)
107
+ end
108
+
109
+ ##
110
+ # Create a fully-qualified CryptoKey resource string.
111
+ #
71
112
  # The resource will be in the following format:
72
113
  #
73
- # `projects/{project}/triggers/{trigger}`
114
+ # `projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}`
74
115
  #
75
116
  # @param project [String]
76
- # @param trigger [String]
117
+ # @param location [String]
118
+ # @param keyring [String]
119
+ # @param key [String]
77
120
  #
78
121
  # @return [::String]
79
- def build_trigger_path project:, trigger:
122
+ def crypto_key_path project:, location:, keyring:, key:
80
123
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
124
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
125
+ raise ::ArgumentError, "keyring cannot contain /" if keyring.to_s.include? "/"
81
126
 
82
- "projects/#{project}/triggers/#{trigger}"
127
+ "projects/#{project}/locations/#{location}/keyRings/#{keyring}/cryptoKeys/#{key}"
83
128
  end
84
129
 
85
130
  ##
@@ -113,6 +158,25 @@ module Google
113
158
  "projects/#{project}"
114
159
  end
115
160
 
161
+ ##
162
+ # Create a fully-qualified SecretVersion resource string.
163
+ #
164
+ # The resource will be in the following format:
165
+ #
166
+ # `projects/{project}/secrets/{secret}/versions/{version}`
167
+ #
168
+ # @param project [String]
169
+ # @param secret [String]
170
+ # @param version [String]
171
+ #
172
+ # @return [::String]
173
+ def secret_version_path project:, secret:, version:
174
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
175
+ raise ::ArgumentError, "secret cannot contain /" if secret.to_s.include? "/"
176
+
177
+ "projects/#{project}/secrets/#{secret}/versions/#{version}"
178
+ end
179
+
116
180
  ##
117
181
  # Create a fully-qualified ServiceAccount resource string.
118
182
  #
@@ -130,6 +194,40 @@ module Google
130
194
  "projects/#{project}/serviceAccounts/#{service_account}"
131
195
  end
132
196
 
197
+ ##
198
+ # Create a fully-qualified Subscription resource string.
199
+ #
200
+ # The resource will be in the following format:
201
+ #
202
+ # `projects/{project}/subscriptions/{subscription}`
203
+ #
204
+ # @param project [String]
205
+ # @param subscription [String]
206
+ #
207
+ # @return [::String]
208
+ def subscription_path project:, subscription:
209
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
210
+
211
+ "projects/#{project}/subscriptions/#{subscription}"
212
+ end
213
+
214
+ ##
215
+ # Create a fully-qualified Topic resource string.
216
+ #
217
+ # The resource will be in the following format:
218
+ #
219
+ # `projects/{project}/topics/{topic}`
220
+ #
221
+ # @param project [String]
222
+ # @param topic [String]
223
+ #
224
+ # @return [::String]
225
+ def topic_path project:, topic:
226
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
227
+
228
+ "projects/#{project}/topics/#{topic}"
229
+ end
230
+
133
231
  extend self
134
232
  end
135
233
  end