google-cloud-sql-v1 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2100,6 +2100,174 @@ module Google
2100
2100
  raise ::Google::Cloud::Error.from_error(e)
2101
2101
  end
2102
2102
 
2103
+ ##
2104
+ # Starts a Cloud SQL instance.
2105
+ #
2106
+ # @overload start(request, options = nil)
2107
+ # Pass arguments to `start` via a request object, either of type
2108
+ # {::Google::Cloud::Sql::V1::SqlInstancesStartRequest} or an equivalent Hash.
2109
+ #
2110
+ # @param request [::Google::Cloud::Sql::V1::SqlInstancesStartRequest, ::Hash]
2111
+ # A request object representing the call parameters. Required. To specify no
2112
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2113
+ # @param options [::Gapic::CallOptions, ::Hash]
2114
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2115
+ #
2116
+ # @overload start(instance: nil, project: nil, location: nil)
2117
+ # Pass arguments to `start` via keyword arguments. Note that at
2118
+ # least one keyword argument is required. To specify no parameters, or to keep all
2119
+ # the default parameter values, pass an empty Hash as a request object (see above).
2120
+ #
2121
+ # @param instance [::String]
2122
+ # Required. Cloud SQL instance ID. This does not include the project ID.
2123
+ # @param project [::String]
2124
+ # Required. Project ID of the project that contains the instance to be
2125
+ # started.
2126
+ # @param location [::String]
2127
+ # Optional. The region of the Cloud SQL instance, for example `us-central1`.
2128
+ # If omitted, the region is determined from the instance.
2129
+ # @yield [result, operation] Access the result along with the TransportOperation object
2130
+ # @yieldparam result [::Google::Cloud::Sql::V1::Operation]
2131
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2132
+ #
2133
+ # @return [::Google::Cloud::Sql::V1::Operation]
2134
+ #
2135
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2136
+ #
2137
+ # @example Basic example
2138
+ # require "google/cloud/sql/v1"
2139
+ #
2140
+ # # Create a client object. The client can be reused for multiple calls.
2141
+ # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new
2142
+ #
2143
+ # # Create a request. To set request fields, pass in keyword arguments.
2144
+ # request = Google::Cloud::Sql::V1::SqlInstancesStartRequest.new
2145
+ #
2146
+ # # Call the start method.
2147
+ # result = client.start request
2148
+ #
2149
+ # # The returned object is of type Google::Cloud::Sql::V1::Operation.
2150
+ # p result
2151
+ #
2152
+ def start request, options = nil
2153
+ raise ::ArgumentError, "request must be provided" if request.nil?
2154
+
2155
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesStartRequest
2156
+
2157
+ # Converts hash and nil to an options object
2158
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2159
+
2160
+ # Customize the options with defaults
2161
+ call_metadata = @config.rpcs.start.metadata.to_h
2162
+
2163
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2164
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2165
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2166
+ gapic_version: ::Google::Cloud::Sql::V1::VERSION,
2167
+ transports_version_send: [:rest]
2168
+
2169
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2170
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2171
+
2172
+ options.apply_defaults timeout: @config.rpcs.start.timeout,
2173
+ metadata: call_metadata,
2174
+ retry_policy: @config.rpcs.start.retry_policy
2175
+
2176
+ options.apply_defaults timeout: @config.timeout,
2177
+ metadata: @config.metadata,
2178
+ retry_policy: @config.retry_policy
2179
+
2180
+ @sql_instances_service_stub.start request, options do |result, operation|
2181
+ yield result, operation if block_given?
2182
+ end
2183
+ rescue ::Gapic::Rest::Error => e
2184
+ raise ::Google::Cloud::Error.from_error(e)
2185
+ end
2186
+
2187
+ ##
2188
+ # Stops a Cloud SQL instance.
2189
+ #
2190
+ # @overload stop(request, options = nil)
2191
+ # Pass arguments to `stop` via a request object, either of type
2192
+ # {::Google::Cloud::Sql::V1::SqlInstancesStopRequest} or an equivalent Hash.
2193
+ #
2194
+ # @param request [::Google::Cloud::Sql::V1::SqlInstancesStopRequest, ::Hash]
2195
+ # A request object representing the call parameters. Required. To specify no
2196
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2197
+ # @param options [::Gapic::CallOptions, ::Hash]
2198
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2199
+ #
2200
+ # @overload stop(instance: nil, project: nil, location: nil)
2201
+ # Pass arguments to `stop` via keyword arguments. Note that at
2202
+ # least one keyword argument is required. To specify no parameters, or to keep all
2203
+ # the default parameter values, pass an empty Hash as a request object (see above).
2204
+ #
2205
+ # @param instance [::String]
2206
+ # Required. Cloud SQL instance ID. This does not include the project ID.
2207
+ # @param project [::String]
2208
+ # Required. Project ID of the project that contains the instance to be
2209
+ # stopped.
2210
+ # @param location [::String]
2211
+ # Optional. The region of the Cloud SQL instance, for example `us-central1`.
2212
+ # If omitted, the region is determined from the instance.
2213
+ # @yield [result, operation] Access the result along with the TransportOperation object
2214
+ # @yieldparam result [::Google::Cloud::Sql::V1::Operation]
2215
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2216
+ #
2217
+ # @return [::Google::Cloud::Sql::V1::Operation]
2218
+ #
2219
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2220
+ #
2221
+ # @example Basic example
2222
+ # require "google/cloud/sql/v1"
2223
+ #
2224
+ # # Create a client object. The client can be reused for multiple calls.
2225
+ # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new
2226
+ #
2227
+ # # Create a request. To set request fields, pass in keyword arguments.
2228
+ # request = Google::Cloud::Sql::V1::SqlInstancesStopRequest.new
2229
+ #
2230
+ # # Call the stop method.
2231
+ # result = client.stop request
2232
+ #
2233
+ # # The returned object is of type Google::Cloud::Sql::V1::Operation.
2234
+ # p result
2235
+ #
2236
+ def stop request, options = nil
2237
+ raise ::ArgumentError, "request must be provided" if request.nil?
2238
+
2239
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesStopRequest
2240
+
2241
+ # Converts hash and nil to an options object
2242
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2243
+
2244
+ # Customize the options with defaults
2245
+ call_metadata = @config.rpcs.stop.metadata.to_h
2246
+
2247
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2248
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2249
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2250
+ gapic_version: ::Google::Cloud::Sql::V1::VERSION,
2251
+ transports_version_send: [:rest]
2252
+
2253
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2254
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2255
+
2256
+ options.apply_defaults timeout: @config.rpcs.stop.timeout,
2257
+ metadata: call_metadata,
2258
+ retry_policy: @config.rpcs.stop.retry_policy
2259
+
2260
+ options.apply_defaults timeout: @config.timeout,
2261
+ metadata: @config.metadata,
2262
+ retry_policy: @config.retry_policy
2263
+
2264
+ @sql_instances_service_stub.stop request, options do |result, operation|
2265
+ yield result, operation if block_given?
2266
+ end
2267
+ rescue ::Gapic::Rest::Error => e
2268
+ raise ::Google::Cloud::Error.from_error(e)
2269
+ end
2270
+
2103
2271
  ##
2104
2272
  # Restores a backup of a Cloud SQL instance. Using this operation might cause
2105
2273
  # your instance to restart.
@@ -3475,6 +3643,90 @@ module Google
3475
3643
  raise ::Google::Cloud::Error.from_error(e)
3476
3644
  end
3477
3645
 
3646
+ ##
3647
+ # Execute SQL statements in read-only mode.
3648
+ #
3649
+ # @overload execute_sql_read_only(request, options = nil)
3650
+ # Pass arguments to `execute_sql_read_only` via a request object, either of type
3651
+ # {::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlReadOnlyRequest} or an equivalent Hash.
3652
+ #
3653
+ # @param request [::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlReadOnlyRequest, ::Hash]
3654
+ # A request object representing the call parameters. Required. To specify no
3655
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3656
+ # @param options [::Gapic::CallOptions, ::Hash]
3657
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
3658
+ #
3659
+ # @overload execute_sql_read_only(instance: nil, project: nil, body: nil, location: nil)
3660
+ # Pass arguments to `execute_sql_read_only` via keyword arguments. Note that at
3661
+ # least one keyword argument is required. To specify no parameters, or to keep all
3662
+ # the default parameter values, pass an empty Hash as a request object (see above).
3663
+ #
3664
+ # @param instance [::String]
3665
+ # Required. Database instance ID. This does not include the project ID.
3666
+ # @param project [::String]
3667
+ # Required. Project ID of the project that contains the instance.
3668
+ # @param body [::Google::Cloud::Sql::V1::ExecuteSqlReadOnlyPayload, ::Hash]
3669
+ # Required. The request body.
3670
+ # @param location [::String]
3671
+ # Optional. Region of the Cloud SQL instance.
3672
+ # @yield [result, operation] Access the result along with the TransportOperation object
3673
+ # @yieldparam result [::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlReadOnlyResponse]
3674
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
3675
+ #
3676
+ # @return [::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlReadOnlyResponse]
3677
+ #
3678
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
3679
+ #
3680
+ # @example Basic example
3681
+ # require "google/cloud/sql/v1"
3682
+ #
3683
+ # # Create a client object. The client can be reused for multiple calls.
3684
+ # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new
3685
+ #
3686
+ # # Create a request. To set request fields, pass in keyword arguments.
3687
+ # request = Google::Cloud::Sql::V1::SqlInstancesExecuteSqlReadOnlyRequest.new
3688
+ #
3689
+ # # Call the execute_sql_read_only method.
3690
+ # result = client.execute_sql_read_only request
3691
+ #
3692
+ # # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesExecuteSqlReadOnlyResponse.
3693
+ # p result
3694
+ #
3695
+ def execute_sql_read_only request, options = nil
3696
+ raise ::ArgumentError, "request must be provided" if request.nil?
3697
+
3698
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlReadOnlyRequest
3699
+
3700
+ # Converts hash and nil to an options object
3701
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3702
+
3703
+ # Customize the options with defaults
3704
+ call_metadata = @config.rpcs.execute_sql_read_only.metadata.to_h
3705
+
3706
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3707
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3708
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3709
+ gapic_version: ::Google::Cloud::Sql::V1::VERSION,
3710
+ transports_version_send: [:rest]
3711
+
3712
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3713
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3714
+
3715
+ options.apply_defaults timeout: @config.rpcs.execute_sql_read_only.timeout,
3716
+ metadata: call_metadata,
3717
+ retry_policy: @config.rpcs.execute_sql_read_only.retry_policy
3718
+
3719
+ options.apply_defaults timeout: @config.timeout,
3720
+ metadata: @config.metadata,
3721
+ retry_policy: @config.retry_policy
3722
+
3723
+ @sql_instances_service_stub.execute_sql_read_only request, options do |result, operation|
3724
+ yield result, operation if block_given?
3725
+ end
3726
+ rescue ::Gapic::Rest::Error => e
3727
+ raise ::Google::Cloud::Error.from_error(e)
3728
+ end
3729
+
3478
3730
  ##
3479
3731
  # Execute SQL statements.
3480
3732
  #
@@ -3900,6 +4152,95 @@ module Google
3900
4152
  raise ::Google::Cloud::Error.from_error(e)
3901
4153
  end
3902
4154
 
4155
+ ##
4156
+ # Repairs and recreates networking resources for a Cloud SQL instance. For
4157
+ # Private Service Connect (PSC), this operation recreates PSC DNS write
4158
+ # endpoints on specified VPC networks and reconciles Private Service Connect
4159
+ # connectivity infrastructure for the instance.
4160
+ #
4161
+ # @overload reconcile_networking(request, options = nil)
4162
+ # Pass arguments to `reconcile_networking` via a request object, either of type
4163
+ # {::Google::Cloud::Sql::V1::SqlInstancesReconcileNetworkingRequest} or an equivalent Hash.
4164
+ #
4165
+ # @param request [::Google::Cloud::Sql::V1::SqlInstancesReconcileNetworkingRequest, ::Hash]
4166
+ # A request object representing the call parameters. Required. To specify no
4167
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
4168
+ # @param options [::Gapic::CallOptions, ::Hash]
4169
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
4170
+ #
4171
+ # @overload reconcile_networking(instance: nil, project: nil, psc_dns: nil, location: nil)
4172
+ # Pass arguments to `reconcile_networking` via keyword arguments. Note that at
4173
+ # least one keyword argument is required. To specify no parameters, or to keep all
4174
+ # the default parameter values, pass an empty Hash as a request object (see above).
4175
+ #
4176
+ # @param instance [::String]
4177
+ # Required. Cloud SQL instance ID.
4178
+ # @param project [::String]
4179
+ # Required. Project ID of the project that contains the instance.
4180
+ # @param psc_dns [::Google::Cloud::Sql::V1::PscDnsReconcileNetworkingRequest, ::Hash]
4181
+ # Request to recreate Private Service Connect DNS write endpoints and
4182
+ # reconcile Private Service Connect connectivity infrastructure for the
4183
+ # instance.
4184
+ # @param location [::String]
4185
+ # Optional. Region of the Cloud SQL instance.
4186
+ # @yield [result, operation] Access the result along with the TransportOperation object
4187
+ # @yieldparam result [::Google::Cloud::Sql::V1::Operation]
4188
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
4189
+ #
4190
+ # @return [::Google::Cloud::Sql::V1::Operation]
4191
+ #
4192
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
4193
+ #
4194
+ # @example Basic example
4195
+ # require "google/cloud/sql/v1"
4196
+ #
4197
+ # # Create a client object. The client can be reused for multiple calls.
4198
+ # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new
4199
+ #
4200
+ # # Create a request. To set request fields, pass in keyword arguments.
4201
+ # request = Google::Cloud::Sql::V1::SqlInstancesReconcileNetworkingRequest.new
4202
+ #
4203
+ # # Call the reconcile_networking method.
4204
+ # result = client.reconcile_networking request
4205
+ #
4206
+ # # The returned object is of type Google::Cloud::Sql::V1::Operation.
4207
+ # p result
4208
+ #
4209
+ def reconcile_networking request, options = nil
4210
+ raise ::ArgumentError, "request must be provided" if request.nil?
4211
+
4212
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesReconcileNetworkingRequest
4213
+
4214
+ # Converts hash and nil to an options object
4215
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
4216
+
4217
+ # Customize the options with defaults
4218
+ call_metadata = @config.rpcs.reconcile_networking.metadata.to_h
4219
+
4220
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
4221
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
4222
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
4223
+ gapic_version: ::Google::Cloud::Sql::V1::VERSION,
4224
+ transports_version_send: [:rest]
4225
+
4226
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
4227
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
4228
+
4229
+ options.apply_defaults timeout: @config.rpcs.reconcile_networking.timeout,
4230
+ metadata: call_metadata,
4231
+ retry_policy: @config.rpcs.reconcile_networking.retry_policy
4232
+
4233
+ options.apply_defaults timeout: @config.timeout,
4234
+ metadata: @config.metadata,
4235
+ retry_policy: @config.retry_policy
4236
+
4237
+ @sql_instances_service_stub.reconcile_networking request, options do |result, operation|
4238
+ yield result, operation if block_given?
4239
+ end
4240
+ rescue ::Gapic::Rest::Error => e
4241
+ raise ::Google::Cloud::Error.from_error(e)
4242
+ end
4243
+
3903
4244
  ##
3904
4245
  # Configuration class for the SqlInstancesService REST API.
3905
4246
  #
@@ -4159,6 +4500,16 @@ module Google
4159
4500
  #
4160
4501
  attr_reader :restart
4161
4502
  ##
4503
+ # RPC-specific configuration for `start`
4504
+ # @return [::Gapic::Config::Method]
4505
+ #
4506
+ attr_reader :start
4507
+ ##
4508
+ # RPC-specific configuration for `stop`
4509
+ # @return [::Gapic::Config::Method]
4510
+ #
4511
+ attr_reader :stop
4512
+ ##
4162
4513
  # RPC-specific configuration for `restore_backup`
4163
4514
  # @return [::Gapic::Config::Method]
4164
4515
  #
@@ -4239,6 +4590,11 @@ module Google
4239
4590
  #
4240
4591
  attr_reader :get_latest_recovery_time
4241
4592
  ##
4593
+ # RPC-specific configuration for `execute_sql_read_only`
4594
+ # @return [::Gapic::Config::Method]
4595
+ #
4596
+ attr_reader :execute_sql_read_only
4597
+ ##
4242
4598
  # RPC-specific configuration for `execute_sql`
4243
4599
  # @return [::Gapic::Config::Method]
4244
4600
  #
@@ -4263,6 +4619,11 @@ module Google
4263
4619
  # @return [::Gapic::Config::Method]
4264
4620
  #
4265
4621
  attr_reader :point_in_time_restore
4622
+ ##
4623
+ # RPC-specific configuration for `reconcile_networking`
4624
+ # @return [::Gapic::Config::Method]
4625
+ #
4626
+ attr_reader :reconcile_networking
4266
4627
 
4267
4628
  # @private
4268
4629
  def initialize parent_rpcs = nil
@@ -4310,6 +4671,10 @@ module Google
4310
4671
  @reset_ssl_config = ::Gapic::Config::Method.new reset_ssl_config_config
4311
4672
  restart_config = parent_rpcs.restart if parent_rpcs.respond_to? :restart
4312
4673
  @restart = ::Gapic::Config::Method.new restart_config
4674
+ start_config = parent_rpcs.start if parent_rpcs.respond_to? :start
4675
+ @start = ::Gapic::Config::Method.new start_config
4676
+ stop_config = parent_rpcs.stop if parent_rpcs.respond_to? :stop
4677
+ @stop = ::Gapic::Config::Method.new stop_config
4313
4678
  restore_backup_config = parent_rpcs.restore_backup if parent_rpcs.respond_to? :restore_backup
4314
4679
  @restore_backup = ::Gapic::Config::Method.new restore_backup_config
4315
4680
  rotate_server_ca_config = parent_rpcs.rotate_server_ca if parent_rpcs.respond_to? :rotate_server_ca
@@ -4342,6 +4707,8 @@ module Google
4342
4707
  @reset_replica_size = ::Gapic::Config::Method.new reset_replica_size_config
4343
4708
  get_latest_recovery_time_config = parent_rpcs.get_latest_recovery_time if parent_rpcs.respond_to? :get_latest_recovery_time
4344
4709
  @get_latest_recovery_time = ::Gapic::Config::Method.new get_latest_recovery_time_config
4710
+ execute_sql_read_only_config = parent_rpcs.execute_sql_read_only if parent_rpcs.respond_to? :execute_sql_read_only
4711
+ @execute_sql_read_only = ::Gapic::Config::Method.new execute_sql_read_only_config
4345
4712
  execute_sql_config = parent_rpcs.execute_sql if parent_rpcs.respond_to? :execute_sql
4346
4713
  @execute_sql = ::Gapic::Config::Method.new execute_sql_config
4347
4714
  acquire_ssrs_lease_config = parent_rpcs.acquire_ssrs_lease if parent_rpcs.respond_to? :acquire_ssrs_lease
@@ -4352,6 +4719,8 @@ module Google
4352
4719
  @pre_check_major_version_upgrade = ::Gapic::Config::Method.new pre_check_major_version_upgrade_config
4353
4720
  point_in_time_restore_config = parent_rpcs.point_in_time_restore if parent_rpcs.respond_to? :point_in_time_restore
4354
4721
  @point_in_time_restore = ::Gapic::Config::Method.new point_in_time_restore_config
4722
+ reconcile_networking_config = parent_rpcs.reconcile_networking if parent_rpcs.respond_to? :reconcile_networking
4723
+ @reconcile_networking = ::Gapic::Config::Method.new reconcile_networking_config
4355
4724
 
4356
4725
  yield self if block_given?
4357
4726
  end