google-cloud-compute-v1 2.5.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +72 -101
  3. data/lib/google/cloud/compute/v1/accelerator_types/rest/client.rb +37 -10
  4. data/lib/google/cloud/compute/v1/accelerator_types/rest/service_stub.rb +14 -2
  5. data/lib/google/cloud/compute/v1/addresses/rest/client.rb +38 -10
  6. data/lib/google/cloud/compute/v1/addresses/rest/service_stub.rb +14 -2
  7. data/lib/google/cloud/compute/v1/autoscalers/rest/client.rb +38 -10
  8. data/lib/google/cloud/compute/v1/autoscalers/rest/service_stub.rb +14 -2
  9. data/lib/google/cloud/compute/v1/backend_buckets/rest/client.rb +311 -8
  10. data/lib/google/cloud/compute/v1/backend_buckets/rest/service_stub.rb +196 -2
  11. data/lib/google/cloud/compute/v1/backend_services/rest/client.rb +230 -10
  12. data/lib/google/cloud/compute/v1/backend_services/rest/service_stub.rb +134 -2
  13. data/lib/google/cloud/compute/v1/compute_pb.rb +79 -1
  14. data/lib/google/cloud/compute/v1/disk_types/rest/client.rb +37 -10
  15. data/lib/google/cloud/compute/v1/disk_types/rest/service_stub.rb +14 -2
  16. data/lib/google/cloud/compute/v1/disks/rest/client.rb +38 -10
  17. data/lib/google/cloud/compute/v1/disks/rest/service_stub.rb +14 -2
  18. data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/client.rb +35 -8
  19. data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/service_stub.rb +14 -2
  20. data/lib/google/cloud/compute/v1/firewall_policies/rest/client.rb +35 -8
  21. data/lib/google/cloud/compute/v1/firewall_policies/rest/service_stub.rb +14 -2
  22. data/lib/google/cloud/compute/v1/firewalls/rest/client.rb +35 -8
  23. data/lib/google/cloud/compute/v1/firewalls/rest/service_stub.rb +14 -2
  24. data/lib/google/cloud/compute/v1/forwarding_rules/rest/client.rb +38 -10
  25. data/lib/google/cloud/compute/v1/forwarding_rules/rest/service_stub.rb +14 -2
  26. data/lib/google/cloud/compute/v1/global_addresses/rest/client.rb +35 -8
  27. data/lib/google/cloud/compute/v1/global_addresses/rest/service_stub.rb +14 -2
  28. data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/client.rb +35 -8
  29. data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/service_stub.rb +14 -2
  30. data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/client.rb +36 -9
  31. data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/service_stub.rb +14 -2
  32. data/lib/google/cloud/compute/v1/global_operations/rest/client.rb +37 -10
  33. data/lib/google/cloud/compute/v1/global_operations/rest/service_stub.rb +14 -2
  34. data/lib/google/cloud/compute/v1/global_organization_operations/rest/client.rb +34 -8
  35. data/lib/google/cloud/compute/v1/global_organization_operations/rest/service_stub.rb +14 -2
  36. data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/client.rb +35 -8
  37. data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/service_stub.rb +14 -2
  38. data/lib/google/cloud/compute/v1/health_checks/rest/client.rb +38 -10
  39. data/lib/google/cloud/compute/v1/health_checks/rest/service_stub.rb +14 -2
  40. data/lib/google/cloud/compute/v1/image_family_views/rest/client.rb +33 -7
  41. data/lib/google/cloud/compute/v1/image_family_views/rest/service_stub.rb +14 -2
  42. data/lib/google/cloud/compute/v1/images/rest/client.rb +35 -8
  43. data/lib/google/cloud/compute/v1/images/rest/service_stub.rb +14 -2
  44. data/lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb +41 -13
  45. data/lib/google/cloud/compute/v1/instance_group_managers/rest/service_stub.rb +14 -2
  46. data/lib/google/cloud/compute/v1/instance_groups/rest/client.rb +39 -11
  47. data/lib/google/cloud/compute/v1/instance_groups/rest/service_stub.rb +14 -2
  48. data/lib/google/cloud/compute/v1/instance_templates/rest/client.rb +38 -10
  49. data/lib/google/cloud/compute/v1/instance_templates/rest/service_stub.rb +14 -2
  50. data/lib/google/cloud/compute/v1/instances/rest/client.rb +143 -11
  51. data/lib/google/cloud/compute/v1/instances/rest/service_stub.rb +76 -2
  52. data/lib/google/cloud/compute/v1/interconnect_attachments/rest/client.rb +38 -10
  53. data/lib/google/cloud/compute/v1/interconnect_attachments/rest/service_stub.rb +14 -2
  54. data/lib/google/cloud/compute/v1/interconnect_locations/rest/client.rb +34 -8
  55. data/lib/google/cloud/compute/v1/interconnect_locations/rest/service_stub.rb +14 -2
  56. data/lib/google/cloud/compute/v1/interconnect_remote_locations/rest/client.rb +34 -8
  57. data/lib/google/cloud/compute/v1/interconnect_remote_locations/rest/service_stub.rb +14 -2
  58. data/lib/google/cloud/compute/v1/interconnects/rest/client.rb +128 -9
  59. data/lib/google/cloud/compute/v1/interconnects/rest/service_stub.rb +74 -2
  60. data/lib/google/cloud/compute/v1/license_codes/rest/client.rb +33 -7
  61. data/lib/google/cloud/compute/v1/license_codes/rest/service_stub.rb +14 -2
  62. data/lib/google/cloud/compute/v1/licenses/rest/client.rb +35 -8
  63. data/lib/google/cloud/compute/v1/licenses/rest/service_stub.rb +14 -2
  64. data/lib/google/cloud/compute/v1/machine_images/rest/client.rb +35 -8
  65. data/lib/google/cloud/compute/v1/machine_images/rest/service_stub.rb +14 -2
  66. data/lib/google/cloud/compute/v1/machine_types/rest/client.rb +37 -10
  67. data/lib/google/cloud/compute/v1/machine_types/rest/service_stub.rb +14 -2
  68. data/lib/google/cloud/compute/v1/network_attachments/rest/client.rb +142 -10
  69. data/lib/google/cloud/compute/v1/network_attachments/rest/service_stub.rb +76 -2
  70. data/lib/google/cloud/compute/v1/network_edge_security_services/rest/client.rb +37 -9
  71. data/lib/google/cloud/compute/v1/network_edge_security_services/rest/service_stub.rb +14 -2
  72. data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb +39 -11
  73. data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/service_stub.rb +14 -2
  74. data/lib/google/cloud/compute/v1/network_firewall_policies/rest/client.rb +35 -8
  75. data/lib/google/cloud/compute/v1/network_firewall_policies/rest/service_stub.rb +14 -2
  76. data/lib/google/cloud/compute/v1/networks/rest/client.rb +36 -9
  77. data/lib/google/cloud/compute/v1/networks/rest/service_stub.rb +14 -2
  78. data/lib/google/cloud/compute/v1/node_groups/rest/client.rb +39 -11
  79. data/lib/google/cloud/compute/v1/node_groups/rest/service_stub.rb +14 -2
  80. data/lib/google/cloud/compute/v1/node_templates/rest/client.rb +38 -10
  81. data/lib/google/cloud/compute/v1/node_templates/rest/service_stub.rb +14 -2
  82. data/lib/google/cloud/compute/v1/node_types/rest/client.rb +37 -10
  83. data/lib/google/cloud/compute/v1/node_types/rest/service_stub.rb +14 -2
  84. data/lib/google/cloud/compute/v1/packet_mirrorings/rest/client.rb +38 -10
  85. data/lib/google/cloud/compute/v1/packet_mirrorings/rest/service_stub.rb +14 -2
  86. data/lib/google/cloud/compute/v1/projects/rest/client.rb +36 -9
  87. data/lib/google/cloud/compute/v1/projects/rest/service_stub.rb +14 -2
  88. data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/client.rb +236 -11
  89. data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/service_stub.rb +134 -2
  90. data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/client.rb +242 -10
  91. data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/service_stub.rb +136 -2
  92. data/lib/google/cloud/compute/v1/region_autoscalers/rest/client.rb +35 -8
  93. data/lib/google/cloud/compute/v1/region_autoscalers/rest/service_stub.rb +14 -2
  94. data/lib/google/cloud/compute/v1/region_backend_services/rest/client.rb +335 -8
  95. data/lib/google/cloud/compute/v1/region_backend_services/rest/service_stub.rb +198 -2
  96. data/lib/google/cloud/compute/v1/region_commitments/rest/client.rb +38 -10
  97. data/lib/google/cloud/compute/v1/region_commitments/rest/service_stub.rb +14 -2
  98. data/lib/google/cloud/compute/v1/region_disk_types/rest/client.rb +34 -8
  99. data/lib/google/cloud/compute/v1/region_disk_types/rest/service_stub.rb +14 -2
  100. data/lib/google/cloud/compute/v1/region_disks/rest/client.rb +35 -8
  101. data/lib/google/cloud/compute/v1/region_disks/rest/service_stub.rb +14 -2
  102. data/lib/google/cloud/compute/v1/region_health_check_services/rest/client.rb +35 -8
  103. data/lib/google/cloud/compute/v1/region_health_check_services/rest/service_stub.rb +14 -2
  104. data/lib/google/cloud/compute/v1/region_health_checks/rest/client.rb +35 -8
  105. data/lib/google/cloud/compute/v1/region_health_checks/rest/service_stub.rb +14 -2
  106. data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/client.rb +38 -11
  107. data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/service_stub.rb +14 -2
  108. data/lib/google/cloud/compute/v1/region_instance_groups/rest/client.rb +36 -9
  109. data/lib/google/cloud/compute/v1/region_instance_groups/rest/service_stub.rb +14 -2
  110. data/lib/google/cloud/compute/v1/region_instance_templates/rest/client.rb +35 -8
  111. data/lib/google/cloud/compute/v1/region_instance_templates/rest/service_stub.rb +14 -2
  112. data/lib/google/cloud/compute/v1/region_instances/rest/client.rb +34 -7
  113. data/lib/google/cloud/compute/v1/region_instances/rest/service_stub.rb +14 -2
  114. data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/client.rb +348 -11
  115. data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/service_stub.rb +199 -2
  116. data/lib/google/cloud/compute/v1/region_network_firewall_policies/rest/client.rb +35 -8
  117. data/lib/google/cloud/compute/v1/region_network_firewall_policies/rest/service_stub.rb +14 -2
  118. data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/client.rb +35 -8
  119. data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/service_stub.rb +14 -2
  120. data/lib/google/cloud/compute/v1/region_operations/rest/client.rb +34 -8
  121. data/lib/google/cloud/compute/v1/region_operations/rest/service_stub.rb +14 -2
  122. data/lib/google/cloud/compute/v1/region_security_policies/rest/client.rb +451 -12
  123. data/lib/google/cloud/compute/v1/region_security_policies/rest/service_stub.rb +260 -2
  124. data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/client.rb +35 -8
  125. data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/service_stub.rb +14 -2
  126. data/lib/google/cloud/compute/v1/region_ssl_policies/rest/client.rb +36 -9
  127. data/lib/google/cloud/compute/v1/region_ssl_policies/rest/service_stub.rb +14 -2
  128. data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/client.rb +35 -8
  129. data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/service_stub.rb +14 -2
  130. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/client.rb +35 -8
  131. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/service_stub.rb +14 -2
  132. data/lib/google/cloud/compute/v1/region_target_tcp_proxies/rest/client.rb +35 -8
  133. data/lib/google/cloud/compute/v1/region_target_tcp_proxies/rest/service_stub.rb +14 -2
  134. data/lib/google/cloud/compute/v1/region_url_maps/rest/client.rb +35 -8
  135. data/lib/google/cloud/compute/v1/region_url_maps/rest/service_stub.rb +14 -2
  136. data/lib/google/cloud/compute/v1/regions/rest/client.rb +34 -8
  137. data/lib/google/cloud/compute/v1/regions/rest/service_stub.rb +14 -2
  138. data/lib/google/cloud/compute/v1/reservations/rest/client.rb +38 -10
  139. data/lib/google/cloud/compute/v1/reservations/rest/service_stub.rb +14 -2
  140. data/lib/google/cloud/compute/v1/resource_policies/rest/client.rb +38 -10
  141. data/lib/google/cloud/compute/v1/resource_policies/rest/service_stub.rb +14 -2
  142. data/lib/google/cloud/compute/v1/rest.rb +1 -0
  143. data/lib/google/cloud/compute/v1/routers/rest/client.rb +135 -11
  144. data/lib/google/cloud/compute/v1/routers/rest/service_stub.rb +75 -2
  145. data/lib/google/cloud/compute/v1/routes/rest/client.rb +35 -8
  146. data/lib/google/cloud/compute/v1/routes/rest/service_stub.rb +14 -2
  147. data/lib/google/cloud/compute/v1/security_policies/rest/client.rb +45 -13
  148. data/lib/google/cloud/compute/v1/security_policies/rest/service_stub.rb +14 -2
  149. data/lib/google/cloud/compute/v1/service_attachments/rest/client.rb +38 -10
  150. data/lib/google/cloud/compute/v1/service_attachments/rest/service_stub.rb +14 -2
  151. data/lib/google/cloud/compute/v1/snapshot_settings_service/credentials.rb +52 -0
  152. data/lib/google/cloud/compute/v1/snapshot_settings_service/rest/client.rb +507 -0
  153. data/lib/google/cloud/compute/v1/snapshot_settings_service/rest/service_stub.rb +179 -0
  154. data/lib/google/cloud/compute/v1/snapshot_settings_service/rest.rb +51 -0
  155. data/lib/google/cloud/compute/v1/snapshot_settings_service.rb +47 -0
  156. data/lib/google/cloud/compute/v1/snapshots/rest/client.rb +35 -8
  157. data/lib/google/cloud/compute/v1/snapshots/rest/service_stub.rb +14 -2
  158. data/lib/google/cloud/compute/v1/ssl_certificates/rest/client.rb +38 -10
  159. data/lib/google/cloud/compute/v1/ssl_certificates/rest/service_stub.rb +14 -2
  160. data/lib/google/cloud/compute/v1/ssl_policies/rest/client.rb +39 -11
  161. data/lib/google/cloud/compute/v1/ssl_policies/rest/service_stub.rb +14 -2
  162. data/lib/google/cloud/compute/v1/subnetworks/rest/client.rb +39 -11
  163. data/lib/google/cloud/compute/v1/subnetworks/rest/service_stub.rb +14 -2
  164. data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/client.rb +35 -8
  165. data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/service_stub.rb +14 -2
  166. data/lib/google/cloud/compute/v1/target_http_proxies/rest/client.rb +38 -10
  167. data/lib/google/cloud/compute/v1/target_http_proxies/rest/service_stub.rb +14 -2
  168. data/lib/google/cloud/compute/v1/target_https_proxies/rest/client.rb +38 -10
  169. data/lib/google/cloud/compute/v1/target_https_proxies/rest/service_stub.rb +14 -2
  170. data/lib/google/cloud/compute/v1/target_instances/rest/client.rb +142 -10
  171. data/lib/google/cloud/compute/v1/target_instances/rest/service_stub.rb +76 -2
  172. data/lib/google/cloud/compute/v1/target_pools/rest/client.rb +142 -10
  173. data/lib/google/cloud/compute/v1/target_pools/rest/service_stub.rb +76 -2
  174. data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/client.rb +35 -8
  175. data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/service_stub.rb +14 -2
  176. data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/client.rb +38 -10
  177. data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/service_stub.rb +14 -2
  178. data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/client.rb +38 -10
  179. data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/service_stub.rb +14 -2
  180. data/lib/google/cloud/compute/v1/url_maps/rest/client.rb +38 -10
  181. data/lib/google/cloud/compute/v1/url_maps/rest/service_stub.rb +14 -2
  182. data/lib/google/cloud/compute/v1/version.rb +1 -1
  183. data/lib/google/cloud/compute/v1/vpn_gateways/rest/client.rb +38 -10
  184. data/lib/google/cloud/compute/v1/vpn_gateways/rest/service_stub.rb +14 -2
  185. data/lib/google/cloud/compute/v1/vpn_tunnels/rest/client.rb +38 -10
  186. data/lib/google/cloud/compute/v1/vpn_tunnels/rest/service_stub.rb +14 -2
  187. data/lib/google/cloud/compute/v1/zone_operations/rest/client.rb +34 -8
  188. data/lib/google/cloud/compute/v1/zone_operations/rest/service_stub.rb +14 -2
  189. data/lib/google/cloud/compute/v1/zones/rest/client.rb +34 -8
  190. data/lib/google/cloud/compute/v1/zones/rest/service_stub.rb +14 -2
  191. data/lib/google/cloud/compute/v1.rb +1 -0
  192. data/proto_docs/google/api/client.rb +14 -0
  193. data/proto_docs/google/cloud/compute/v1/compute.rb +1654 -196
  194. data/proto_docs/google/protobuf/any.rb +144 -0
  195. metadata +11 -5
@@ -33,6 +33,9 @@ module Google
33
33
  # The TargetHttpsProxies API.
34
34
  #
35
35
  class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "compute.$UNIVERSE_DOMAIN$"
38
+
36
39
  # @private
37
40
  attr_reader :target_https_proxies_stub
38
41
 
@@ -122,6 +125,15 @@ module Google
122
125
  @config
123
126
  end
124
127
 
128
+ ##
129
+ # The effective universe domain
130
+ #
131
+ # @return [String]
132
+ #
133
+ def universe_domain
134
+ @target_https_proxies_stub.universe_domain
135
+ end
136
+
125
137
  ##
126
138
  # Create a new TargetHttpsProxies REST client object.
127
139
  #
@@ -149,8 +161,9 @@ module Google
149
161
  credentials = @config.credentials
150
162
  # Use self-signed JWT if the endpoint is unchanged from default,
151
163
  # but only if the default endpoint does not have a region prefix.
152
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
153
- !@config.endpoint.split(".").first.include?("-")
164
+ enable_self_signed_jwt = @config.endpoint.nil? ||
165
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
166
+ !@config.endpoint.split(".").first.include?("-"))
154
167
  credentials ||= Credentials.default scope: @config.scope,
155
168
  enable_self_signed_jwt: enable_self_signed_jwt
156
169
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -164,9 +177,15 @@ module Google
164
177
  config.credentials = credentials
165
178
  config.quota_project = @quota_project_id
166
179
  config.endpoint = @config.endpoint
180
+ config.universe_domain = @config.universe_domain
167
181
  end
168
182
 
169
- @target_https_proxies_stub = ::Google::Cloud::Compute::V1::TargetHttpsProxies::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
183
+ @target_https_proxies_stub = ::Google::Cloud::Compute::V1::TargetHttpsProxies::Rest::ServiceStub.new(
184
+ endpoint: @config.endpoint,
185
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
186
+ universe_domain: @config.universe_domain,
187
+ credentials: credentials
188
+ )
170
189
  end
171
190
 
172
191
  ##
@@ -191,13 +210,13 @@ module Google
191
210
  # @param options [::Gapic::CallOptions, ::Hash]
192
211
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
193
212
  #
194
- # @overload aggregated_list(filter: nil, include_all_scopes: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil)
213
+ # @overload aggregated_list(filter: nil, include_all_scopes: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, service_project_number: nil)
195
214
  # Pass arguments to `aggregated_list` via keyword arguments. Note that at
196
215
  # least one keyword argument is required. To specify no parameters, or to keep all
197
216
  # the default parameter values, pass an empty Hash as a request object (see above).
198
217
  #
199
218
  # @param filter [::String]
200
- # A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`.
219
+ # A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.
201
220
  # @param include_all_scopes [::Boolean]
202
221
  # Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included.
203
222
  # @param max_results [::Integer]
@@ -210,6 +229,7 @@ module Google
210
229
  # Name of the project scoping this request.
211
230
  # @param return_partial_success [::Boolean]
212
231
  # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false.
232
+ # @param service_project_number [::Integer]
213
233
  # @yield [result, operation] Access the result along with the TransportOperation object
214
234
  # @yieldparam result [::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::TargetHttpsProxiesScopedList>]
215
235
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -548,7 +568,7 @@ module Google
548
568
  # the default parameter values, pass an empty Hash as a request object (see above).
549
569
  #
550
570
  # @param filter [::String]
551
- # A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`.
571
+ # A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.
552
572
  # @param max_results [::Integer]
553
573
  # The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
554
574
  # @param order_by [::String]
@@ -1200,9 +1220,9 @@ module Google
1200
1220
  # end
1201
1221
  #
1202
1222
  # @!attribute [rw] endpoint
1203
- # The hostname or hostname:port of the service endpoint.
1204
- # Defaults to `"compute.googleapis.com"`.
1205
- # @return [::String]
1223
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1224
+ # nil, indicating to use the default endpoint in the current universe domain.
1225
+ # @return [::String,nil]
1206
1226
  # @!attribute [rw] credentials
1207
1227
  # Credentials to send with calls. You may provide any of the following types:
1208
1228
  # * (`String`) The path to a service account key file in JSON format
@@ -1239,13 +1259,20 @@ module Google
1239
1259
  # @!attribute [rw] quota_project
1240
1260
  # A separate project against which to charge quota.
1241
1261
  # @return [::String]
1262
+ # @!attribute [rw] universe_domain
1263
+ # The universe domain within which to make requests. This determines the
1264
+ # default endpoint URL. The default value of nil uses the environment
1265
+ # universe (usually the default "googleapis.com" universe).
1266
+ # @return [::String,nil]
1242
1267
  #
1243
1268
  class Configuration
1244
1269
  extend ::Gapic::Config
1245
1270
 
1271
+ # @private
1272
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1246
1273
  DEFAULT_ENDPOINT = "compute.googleapis.com"
1247
1274
 
1248
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1275
+ config_attr :endpoint, nil, ::String, nil
1249
1276
  config_attr :credentials, nil do |value|
1250
1277
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1251
1278
  allowed.any? { |klass| klass === value }
@@ -1257,6 +1284,7 @@ module Google
1257
1284
  config_attr :metadata, nil, ::Hash, nil
1258
1285
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1259
1286
  config_attr :quota_project, nil, ::String, nil
1287
+ config_attr :universe_domain, nil, ::String, nil
1260
1288
 
1261
1289
  # @private
1262
1290
  def initialize parent_config = nil
@@ -30,16 +30,28 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, credentials:
33
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
34
  # These require statements are intentionally placed here to initialize
35
35
  # the REST modules only when it's required.
36
36
  require "gapic/rest"
37
37
 
38
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
39
+ endpoint_template: endpoint_template,
40
+ universe_domain: universe_domain,
41
+ credentials: credentials,
39
42
  numeric_enums: false,
40
43
  raise_faraday_errors: false
41
44
  end
42
45
 
46
+ ##
47
+ # The effective universe domain
48
+ #
49
+ # @return [String]
50
+ #
51
+ def universe_domain
52
+ @client_stub.universe_domain
53
+ end
54
+
43
55
  ##
44
56
  # Baseline implementation for the aggregated_list REST call
45
57
  #
@@ -33,6 +33,9 @@ module Google
33
33
  # The TargetInstances API.
34
34
  #
35
35
  class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "compute.$UNIVERSE_DOMAIN$"
38
+
36
39
  # @private
37
40
  attr_reader :target_instances_stub
38
41
 
@@ -84,6 +87,8 @@ module Google
84
87
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
85
88
  }
86
89
 
90
+ default_config.rpcs.set_security_policy.timeout = 600.0
91
+
87
92
  default_config
88
93
  end
89
94
  yield @configure if block_given?
@@ -110,6 +115,15 @@ module Google
110
115
  @config
111
116
  end
112
117
 
118
+ ##
119
+ # The effective universe domain
120
+ #
121
+ # @return [String]
122
+ #
123
+ def universe_domain
124
+ @target_instances_stub.universe_domain
125
+ end
126
+
113
127
  ##
114
128
  # Create a new TargetInstances REST client object.
115
129
  #
@@ -137,8 +151,9 @@ module Google
137
151
  credentials = @config.credentials
138
152
  # Use self-signed JWT if the endpoint is unchanged from default,
139
153
  # but only if the default endpoint does not have a region prefix.
140
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
141
- !@config.endpoint.split(".").first.include?("-")
154
+ enable_self_signed_jwt = @config.endpoint.nil? ||
155
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
156
+ !@config.endpoint.split(".").first.include?("-"))
142
157
  credentials ||= Credentials.default scope: @config.scope,
143
158
  enable_self_signed_jwt: enable_self_signed_jwt
144
159
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -152,9 +167,15 @@ module Google
152
167
  config.credentials = credentials
153
168
  config.quota_project = @quota_project_id
154
169
  config.endpoint = @config.endpoint
170
+ config.universe_domain = @config.universe_domain
155
171
  end
156
172
 
157
- @target_instances_stub = ::Google::Cloud::Compute::V1::TargetInstances::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
173
+ @target_instances_stub = ::Google::Cloud::Compute::V1::TargetInstances::Rest::ServiceStub.new(
174
+ endpoint: @config.endpoint,
175
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
176
+ universe_domain: @config.universe_domain,
177
+ credentials: credentials
178
+ )
158
179
  end
159
180
 
160
181
  ##
@@ -179,13 +200,13 @@ module Google
179
200
  # @param options [::Gapic::CallOptions, ::Hash]
180
201
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
181
202
  #
182
- # @overload aggregated_list(filter: nil, include_all_scopes: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil)
203
+ # @overload aggregated_list(filter: nil, include_all_scopes: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, service_project_number: nil)
183
204
  # Pass arguments to `aggregated_list` via keyword arguments. Note that at
184
205
  # least one keyword argument is required. To specify no parameters, or to keep all
185
206
  # the default parameter values, pass an empty Hash as a request object (see above).
186
207
  #
187
208
  # @param filter [::String]
188
- # A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`.
209
+ # A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.
189
210
  # @param include_all_scopes [::Boolean]
190
211
  # Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included.
191
212
  # @param max_results [::Integer]
@@ -198,6 +219,7 @@ module Google
198
219
  # Project ID for this request.
199
220
  # @param return_partial_success [::Boolean]
200
221
  # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false.
222
+ # @param service_project_number [::Integer]
201
223
  # @yield [result, operation] Access the result along with the TransportOperation object
202
224
  # @yieldparam result [::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::TargetInstancesScopedList>]
203
225
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -544,7 +566,7 @@ module Google
544
566
  # the default parameter values, pass an empty Hash as a request object (see above).
545
567
  #
546
568
  # @param filter [::String]
547
- # A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`.
569
+ # A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.
548
570
  # @param max_results [::Integer]
549
571
  # The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
550
572
  # @param order_by [::String]
@@ -616,6 +638,101 @@ module Google
616
638
  raise ::Google::Cloud::Error.from_error(e)
617
639
  end
618
640
 
641
+ ##
642
+ # Sets the Google Cloud Armor security policy for the specified target instance. For more information, see Google Cloud Armor Overview
643
+ #
644
+ # @overload set_security_policy(request, options = nil)
645
+ # Pass arguments to `set_security_policy` via a request object, either of type
646
+ # {::Google::Cloud::Compute::V1::SetSecurityPolicyTargetInstanceRequest} or an equivalent Hash.
647
+ #
648
+ # @param request [::Google::Cloud::Compute::V1::SetSecurityPolicyTargetInstanceRequest, ::Hash]
649
+ # A request object representing the call parameters. Required. To specify no
650
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
651
+ # @param options [::Gapic::CallOptions, ::Hash]
652
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
653
+ #
654
+ # @overload set_security_policy(project: nil, request_id: nil, security_policy_reference_resource: nil, target_instance: nil, zone: nil)
655
+ # Pass arguments to `set_security_policy` via keyword arguments. Note that at
656
+ # least one keyword argument is required. To specify no parameters, or to keep all
657
+ # the default parameter values, pass an empty Hash as a request object (see above).
658
+ #
659
+ # @param project [::String]
660
+ # Project ID for this request.
661
+ # @param request_id [::String]
662
+ # An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
663
+ # @param security_policy_reference_resource [::Google::Cloud::Compute::V1::SecurityPolicyReference, ::Hash]
664
+ # The body resource for this request
665
+ # @param target_instance [::String]
666
+ # Name of the TargetInstance resource to which the security policy should be set. The name should conform to RFC1035.
667
+ # @param zone [::String]
668
+ # Name of the zone scoping this request.
669
+ # @yield [result, operation] Access the result along with the TransportOperation object
670
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
671
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
672
+ #
673
+ # @return [::Gapic::GenericLRO::Operation]
674
+ #
675
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
676
+ #
677
+ # @example Basic example
678
+ # require "google/cloud/compute/v1"
679
+ #
680
+ # # Create a client object. The client can be reused for multiple calls.
681
+ # client = Google::Cloud::Compute::V1::TargetInstances::Rest::Client.new
682
+ #
683
+ # # Create a request. To set request fields, pass in keyword arguments.
684
+ # request = Google::Cloud::Compute::V1::SetSecurityPolicyTargetInstanceRequest.new
685
+ #
686
+ # # Call the set_security_policy method.
687
+ # result = client.set_security_policy request
688
+ #
689
+ # # The returned object is of type Google::Cloud::Compute::V1::Operation.
690
+ # p result
691
+ #
692
+ def set_security_policy request, options = nil
693
+ raise ::ArgumentError, "request must be provided" if request.nil?
694
+
695
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetSecurityPolicyTargetInstanceRequest
696
+
697
+ # Converts hash and nil to an options object
698
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
699
+
700
+ # Customize the options with defaults
701
+ call_metadata = @config.rpcs.set_security_policy.metadata.to_h
702
+
703
+ # Set x-goog-api-client and x-goog-user-project headers
704
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
705
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
706
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
707
+ transports_version_send: [:rest]
708
+
709
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
710
+
711
+ options.apply_defaults timeout: @config.rpcs.set_security_policy.timeout,
712
+ metadata: call_metadata,
713
+ retry_policy: @config.rpcs.set_security_policy.retry_policy
714
+
715
+ options.apply_defaults timeout: @config.timeout,
716
+ metadata: @config.metadata,
717
+ retry_policy: @config.retry_policy
718
+
719
+ @target_instances_stub.set_security_policy request, options do |result, response|
720
+ result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
721
+ operation: result,
722
+ client: zone_operations,
723
+ request_values: {
724
+ "project" => request.project,
725
+ "zone" => request.zone
726
+ },
727
+ options: options
728
+ )
729
+ yield result, response if block_given?
730
+ return result
731
+ end
732
+ rescue ::Gapic::Rest::Error => e
733
+ raise ::Google::Cloud::Error.from_error(e)
734
+ end
735
+
619
736
  ##
620
737
  # Configuration class for the TargetInstances REST API.
621
738
  #
@@ -646,9 +763,9 @@ module Google
646
763
  # end
647
764
  #
648
765
  # @!attribute [rw] endpoint
649
- # The hostname or hostname:port of the service endpoint.
650
- # Defaults to `"compute.googleapis.com"`.
651
- # @return [::String]
766
+ # A custom service endpoint, as a hostname or hostname:port. The default is
767
+ # nil, indicating to use the default endpoint in the current universe domain.
768
+ # @return [::String,nil]
652
769
  # @!attribute [rw] credentials
653
770
  # Credentials to send with calls. You may provide any of the following types:
654
771
  # * (`String`) The path to a service account key file in JSON format
@@ -685,13 +802,20 @@ module Google
685
802
  # @!attribute [rw] quota_project
686
803
  # A separate project against which to charge quota.
687
804
  # @return [::String]
805
+ # @!attribute [rw] universe_domain
806
+ # The universe domain within which to make requests. This determines the
807
+ # default endpoint URL. The default value of nil uses the environment
808
+ # universe (usually the default "googleapis.com" universe).
809
+ # @return [::String,nil]
688
810
  #
689
811
  class Configuration
690
812
  extend ::Gapic::Config
691
813
 
814
+ # @private
815
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
692
816
  DEFAULT_ENDPOINT = "compute.googleapis.com"
693
817
 
694
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
818
+ config_attr :endpoint, nil, ::String, nil
695
819
  config_attr :credentials, nil do |value|
696
820
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
697
821
  allowed.any? { |klass| klass === value }
@@ -703,6 +827,7 @@ module Google
703
827
  config_attr :metadata, nil, ::Hash, nil
704
828
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
705
829
  config_attr :quota_project, nil, ::String, nil
830
+ config_attr :universe_domain, nil, ::String, nil
706
831
 
707
832
  # @private
708
833
  def initialize parent_config = nil
@@ -766,6 +891,11 @@ module Google
766
891
  # @return [::Gapic::Config::Method]
767
892
  #
768
893
  attr_reader :list
894
+ ##
895
+ # RPC-specific configuration for `set_security_policy`
896
+ # @return [::Gapic::Config::Method]
897
+ #
898
+ attr_reader :set_security_policy
769
899
 
770
900
  # @private
771
901
  def initialize parent_rpcs = nil
@@ -779,6 +909,8 @@ module Google
779
909
  @insert = ::Gapic::Config::Method.new insert_config
780
910
  list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
781
911
  @list = ::Gapic::Config::Method.new list_config
912
+ set_security_policy_config = parent_rpcs.set_security_policy if parent_rpcs.respond_to? :set_security_policy
913
+ @set_security_policy = ::Gapic::Config::Method.new set_security_policy_config
782
914
 
783
915
  yield self if block_given?
784
916
  end
@@ -30,16 +30,28 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, credentials:
33
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
34
  # These require statements are intentionally placed here to initialize
35
35
  # the REST modules only when it's required.
36
36
  require "gapic/rest"
37
37
 
38
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
39
+ endpoint_template: endpoint_template,
40
+ universe_domain: universe_domain,
41
+ credentials: credentials,
39
42
  numeric_enums: false,
40
43
  raise_faraday_errors: false
41
44
  end
42
45
 
46
+ ##
47
+ # The effective universe domain
48
+ #
49
+ # @return [String]
50
+ #
51
+ def universe_domain
52
+ @client_stub.universe_domain
53
+ end
54
+
43
55
  ##
44
56
  # Baseline implementation for the aggregated_list REST call
45
57
  #
@@ -230,6 +242,44 @@ module Google
230
242
  result
231
243
  end
232
244
 
245
+ ##
246
+ # Baseline implementation for the set_security_policy REST call
247
+ #
248
+ # @param request_pb [::Google::Cloud::Compute::V1::SetSecurityPolicyTargetInstanceRequest]
249
+ # A request object representing the call parameters. Required.
250
+ # @param options [::Gapic::CallOptions]
251
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
252
+ #
253
+ # @yield [result, operation] Access the result along with the TransportOperation object
254
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
255
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
256
+ #
257
+ # @return [::Google::Cloud::Compute::V1::Operation]
258
+ # A result object deserialized from the server's reply
259
+ def set_security_policy request_pb, options = nil
260
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
261
+
262
+ verb, uri, query_string_params, body = ServiceStub.transcode_set_security_policy_request request_pb
263
+ query_string_params = if query_string_params.any?
264
+ query_string_params.to_h { |p| p.split "=", 2 }
265
+ else
266
+ {}
267
+ end
268
+
269
+ response = @client_stub.make_http_request(
270
+ verb,
271
+ uri: uri,
272
+ body: body || "",
273
+ params: query_string_params,
274
+ options: options
275
+ )
276
+ operation = ::Gapic::Rest::TransportOperation.new response
277
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
278
+
279
+ yield result, operation if block_given?
280
+ result
281
+ end
282
+
233
283
  ##
234
284
  # @private
235
285
  #
@@ -341,6 +391,30 @@ module Google
341
391
  )
342
392
  transcoder.transcode request_pb
343
393
  end
394
+
395
+ ##
396
+ # @private
397
+ #
398
+ # GRPC transcoding helper method for the set_security_policy REST call
399
+ #
400
+ # @param request_pb [::Google::Cloud::Compute::V1::SetSecurityPolicyTargetInstanceRequest]
401
+ # A request object representing the call parameters. Required.
402
+ # @return [Array(String, [String, nil], Hash{String => String})]
403
+ # Uri, Body, Query string parameters
404
+ def self.transcode_set_security_policy_request request_pb
405
+ transcoder = Gapic::Rest::GrpcTranscoder.new
406
+ .with_bindings(
407
+ uri_method: :post,
408
+ uri_template: "/compute/v1/projects/{project}/zones/{zone}/targetInstances/{target_instance}/setSecurityPolicy",
409
+ body: "security_policy_reference_resource",
410
+ matches: [
411
+ ["project", %r{^[^/]+/?$}, false],
412
+ ["zone", %r{^[^/]+/?$}, false],
413
+ ["target_instance", %r{^[^/]+/?$}, false]
414
+ ]
415
+ )
416
+ transcoder.transcode request_pb
417
+ end
344
418
  end
345
419
  end
346
420
  end