google-cloud-memcache-v1beta2 0.3.0 → 0.5.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: 7f7c1a4548994435833ddff589eafad2407e258138cf0ff498c33144d7783f48
4
- data.tar.gz: 95699bc2aa00bfcea2df006ae62c9ad40af6982a2e5a185e183a1d190f7cabce
3
+ metadata.gz: 81b2144f905c79db0e000e2d34dce16e717e17a08702ba77673bfae297d39f43
4
+ data.tar.gz: 047ffa0de0e1dab1f364a481ed189200e440de86679c58d8f4312a71aa3dbeff
5
5
  SHA512:
6
- metadata.gz: 97ca9b60937d0f4f32424f3de796abd30a52a21dbb8b9db3ae85fdfbf154ecab16b0f4aa7515f00be91e4e333238009a8a860dd1459587558141651617a1cc1b
7
- data.tar.gz: 1a677ba1d6df6d5c2acf42adb5a72425b8f4dab729650ee6ac44d49b6d9ac6a1dce3bb12fccfa1fb887f29c8fbd997ff9bc340b07390fc961322860a25227573
6
+ metadata.gz: 4d5a059338bd05d84e1adb9ddcd9523ffa7c04b8cf7bf7c0cb46e50c3372da7e09268f62af195c280173ea17c1499b8d2956b7c92e42bbb606a6838b7cb9c393
7
+ data.tar.gz: 83173c7140b895800ba0cc17331f27af8fafc70fb94f4751ed7bd465d59047eed4da978eba162dfca3deec3adb1e290ea2b9c8b176d8e892f12df6659944ea40
data/AUTHENTICATION.md CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
114
114
  To configure your system for this, simply:
115
115
 
116
116
  1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
117
- 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
117
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
118
118
  3. Write code as if already authenticated.
119
119
 
120
120
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ruby Client for the Google Cloud Memorystore for Memcached API
2
2
 
3
- API Client library for the Google Cloud Memorystore for Memcached API
3
+ Google Cloud Memorystore for Memcached API is used for creating and managing Memcached instances in GCP.
4
4
 
5
5
  Google Cloud Memorystore for Memcached API is used for creating and managing Memcached instances in GCP.
6
6
 
@@ -46,7 +46,7 @@ for general usage information.
46
46
  ## Enabling Logging
47
47
 
48
48
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
49
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
50
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
51
51
  that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
52
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/config"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Memcache
24
+ ##
25
+ # @example Loading just the REST part of this package, including all its services, and instantiating a REST client
26
+ #
27
+ # require "google/cloud/memcache/v1beta2/rest"
28
+ # client = ::Google::Cloud::Memcache::V1beta2::CloudMemcache::Rest::Client.new
29
+ #
30
+ module V1beta2
31
+ ##
32
+ # @private
33
+ # Initialize the mixin bindings configuration
34
+ #
35
+ def self.configure
36
+ @configure ||= begin
37
+ namespace = ["Google", "Cloud", "Memcache"]
38
+ parent_config = while namespace.any?
39
+ parent_name = namespace.join "::"
40
+ parent_const = const_get parent_name
41
+ break parent_const.configure if parent_const.respond_to? :configure
42
+ namespace.pop
43
+ end
44
+
45
+ default_config = Configuration.new parent_config
46
+ default_config.bindings_override["google.cloud.location.Locations.GetLocation"] = [
47
+ Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation(
48
+ uri_method: :get,
49
+ uri_template: "/v1beta2/{name}",
50
+ matches: [
51
+ ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
52
+ ],
53
+ body: nil
54
+ )
55
+ ]
56
+ default_config.bindings_override["google.cloud.location.Locations.ListLocations"] = [
57
+
58
+ Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation(
59
+ uri_method: :get,
60
+ uri_template: "/v1beta2/{name}/locations",
61
+ matches: [
62
+ ["name", %r{^projects/[^/]+/?$}, false]
63
+ ],
64
+ body: nil
65
+ )
66
+ ]
67
+ default_config
68
+ end
69
+ yield @configure if block_given?
70
+ @configure
71
+ end
72
+
73
+ ##
74
+ # @private
75
+ # Configuration class for the google.cloud.memcache.v1beta2 package.
76
+ #
77
+ # This class contains common configuration for all services
78
+ # of the google.cloud.memcache.v1beta2 package.
79
+ #
80
+ # This configuration is for internal use of the client library classes,
81
+ # and it is not intended that the end-users will read or change it.
82
+ #
83
+ class Configuration
84
+ extend ::Gapic::Config
85
+
86
+ # @private
87
+ # Overrides for http bindings for the RPC of the mixins for this package.
88
+ # Services in this package should use these when creating clients for the mixin services.
89
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
90
+ config_attr :bindings_override, {}, ::Hash, nil
91
+
92
+ # @private
93
+ def initialize parent_config = nil
94
+ @parent_config = parent_config unless parent_config.nil?
95
+
96
+ yield self if block_given?
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/memcache/v1beta2/cloud_memcache_pb"
21
+ require "google/cloud/location"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -94,6 +95,8 @@ module Google
94
95
 
95
96
  default_config.rpcs.apply_software_update.timeout = 1200.0
96
97
 
98
+ default_config.rpcs.reschedule_maintenance.timeout = 1200.0
99
+
97
100
  default_config
98
101
  end
99
102
  yield @configure if block_given?
@@ -169,6 +172,12 @@ module Google
169
172
  config.endpoint = @config.endpoint
170
173
  end
171
174
 
175
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
176
+ config.credentials = credentials
177
+ config.quota_project = @quota_project_id
178
+ config.endpoint = @config.endpoint
179
+ end
180
+
172
181
  @cloud_memcache_stub = ::Gapic::ServiceStub.new(
173
182
  ::Google::Cloud::Memcache::V1beta2::CloudMemcache::Stub,
174
183
  credentials: credentials,
@@ -185,6 +194,13 @@ module Google
185
194
  #
186
195
  attr_reader :operations_client
187
196
 
197
+ ##
198
+ # Get the associated client for mix-in of the Locations.
199
+ #
200
+ # @return [Google::Cloud::Location::Locations::Client]
201
+ #
202
+ attr_reader :location_client
203
+
188
204
  # Service calls
189
205
 
190
206
  ##
@@ -245,13 +261,11 @@ module Google
245
261
  # # Call the list_instances method.
246
262
  # result = client.list_instances request
247
263
  #
248
- # # The returned object is of type Gapic::PagedEnumerable. You can
249
- # # iterate over all elements by calling #each, and the enumerable
250
- # # will lazily make API calls to fetch subsequent pages. Other
251
- # # methods are also available for managing paging directly.
252
- # result.each do |response|
264
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
265
+ # # over elements, and API calls will be issued to fetch pages as needed.
266
+ # result.each do |item|
253
267
  # # Each element is of type ::Google::Cloud::Memcache::V1beta2::Instance.
254
- # p response
268
+ # p item
255
269
  # end
256
270
  #
257
271
  def list_instances request, options = nil
@@ -439,14 +453,14 @@ module Google
439
453
  # # Call the create_instance method.
440
454
  # result = client.create_instance request
441
455
  #
442
- # # The returned object is of type Gapic::Operation. You can use this
443
- # # object to check the status of an operation, cancel it, or wait
444
- # # for results. Here is how to block until completion:
456
+ # # The returned object is of type Gapic::Operation. You can use it to
457
+ # # check the status of an operation, cancel it, or wait for results.
458
+ # # Here is how to wait for a response.
445
459
  # result.wait_until_done! timeout: 60
446
460
  # if result.response?
447
461
  # p result.response
448
462
  # else
449
- # puts "Error!"
463
+ # puts "No response received."
450
464
  # end
451
465
  #
452
466
  def create_instance request, options = nil
@@ -511,6 +525,7 @@ module Google
511
525
  #
512
526
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
513
527
  # Required. Mask of fields to update.
528
+ #
514
529
  # * `displayName`
515
530
  # @param resource [::Google::Cloud::Memcache::V1beta2::Instance, ::Hash]
516
531
  # Required. A Memcached [Instance] resource.
@@ -536,14 +551,14 @@ module Google
536
551
  # # Call the update_instance method.
537
552
  # result = client.update_instance request
538
553
  #
539
- # # The returned object is of type Gapic::Operation. You can use this
540
- # # object to check the status of an operation, cancel it, or wait
541
- # # for results. Here is how to block until completion:
554
+ # # The returned object is of type Gapic::Operation. You can use it to
555
+ # # check the status of an operation, cancel it, or wait for results.
556
+ # # Here is how to wait for a response.
542
557
  # result.wait_until_done! timeout: 60
543
558
  # if result.response?
544
559
  # p result.response
545
560
  # else
546
- # puts "Error!"
561
+ # puts "No response received."
547
562
  # end
548
563
  #
549
564
  def update_instance request, options = nil
@@ -637,14 +652,14 @@ module Google
637
652
  # # Call the update_parameters method.
638
653
  # result = client.update_parameters request
639
654
  #
640
- # # The returned object is of type Gapic::Operation. You can use this
641
- # # object to check the status of an operation, cancel it, or wait
642
- # # for results. Here is how to block until completion:
655
+ # # The returned object is of type Gapic::Operation. You can use it to
656
+ # # check the status of an operation, cancel it, or wait for results.
657
+ # # Here is how to wait for a response.
643
658
  # result.wait_until_done! timeout: 60
644
659
  # if result.response?
645
660
  # p result.response
646
661
  # else
647
- # puts "Error!"
662
+ # puts "No response received."
648
663
  # end
649
664
  #
650
665
  def update_parameters request, options = nil
@@ -732,14 +747,14 @@ module Google
732
747
  # # Call the delete_instance method.
733
748
  # result = client.delete_instance request
734
749
  #
735
- # # The returned object is of type Gapic::Operation. You can use this
736
- # # object to check the status of an operation, cancel it, or wait
737
- # # for results. Here is how to block until completion:
750
+ # # The returned object is of type Gapic::Operation. You can use it to
751
+ # # check the status of an operation, cancel it, or wait for results.
752
+ # # Here is how to wait for a response.
738
753
  # result.wait_until_done! timeout: 60
739
754
  # if result.response?
740
755
  # p result.response
741
756
  # else
742
- # puts "Error!"
757
+ # puts "No response received."
743
758
  # end
744
759
  #
745
760
  def delete_instance request, options = nil
@@ -833,14 +848,14 @@ module Google
833
848
  # # Call the apply_parameters method.
834
849
  # result = client.apply_parameters request
835
850
  #
836
- # # The returned object is of type Gapic::Operation. You can use this
837
- # # object to check the status of an operation, cancel it, or wait
838
- # # for results. Here is how to block until completion:
851
+ # # The returned object is of type Gapic::Operation. You can use it to
852
+ # # check the status of an operation, cancel it, or wait for results.
853
+ # # Here is how to wait for a response.
839
854
  # result.wait_until_done! timeout: 60
840
855
  # if result.response?
841
856
  # p result.response
842
857
  # else
843
- # puts "Error!"
858
+ # puts "No response received."
844
859
  # end
845
860
  #
846
861
  def apply_parameters request, options = nil
@@ -934,14 +949,14 @@ module Google
934
949
  # # Call the apply_software_update method.
935
950
  # result = client.apply_software_update request
936
951
  #
937
- # # The returned object is of type Gapic::Operation. You can use this
938
- # # object to check the status of an operation, cancel it, or wait
939
- # # for results. Here is how to block until completion:
952
+ # # The returned object is of type Gapic::Operation. You can use it to
953
+ # # check the status of an operation, cancel it, or wait for results.
954
+ # # Here is how to wait for a response.
940
955
  # result.wait_until_done! timeout: 60
941
956
  # if result.response?
942
957
  # p result.response
943
958
  # else
944
- # puts "Error!"
959
+ # puts "No response received."
945
960
  # end
946
961
  #
947
962
  def apply_software_update request, options = nil
@@ -986,6 +1001,107 @@ module Google
986
1001
  raise ::Google::Cloud::Error.from_error(e)
987
1002
  end
988
1003
 
1004
+ ##
1005
+ # Performs the apply phase of the RescheduleMaintenance verb.
1006
+ #
1007
+ # @overload reschedule_maintenance(request, options = nil)
1008
+ # Pass arguments to `reschedule_maintenance` via a request object, either of type
1009
+ # {::Google::Cloud::Memcache::V1beta2::RescheduleMaintenanceRequest} or an equivalent Hash.
1010
+ #
1011
+ # @param request [::Google::Cloud::Memcache::V1beta2::RescheduleMaintenanceRequest, ::Hash]
1012
+ # A request object representing the call parameters. Required. To specify no
1013
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1014
+ # @param options [::Gapic::CallOptions, ::Hash]
1015
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1016
+ #
1017
+ # @overload reschedule_maintenance(instance: nil, reschedule_type: nil, schedule_time: nil)
1018
+ # Pass arguments to `reschedule_maintenance` via keyword arguments. Note that at
1019
+ # least one keyword argument is required. To specify no parameters, or to keep all
1020
+ # the default parameter values, pass an empty Hash as a request object (see above).
1021
+ #
1022
+ # @param instance [::String]
1023
+ # Required. Memcache instance resource name using the form:
1024
+ # `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
1025
+ # where `location_id` refers to a GCP region.
1026
+ # @param reschedule_type [::Google::Cloud::Memcache::V1beta2::RescheduleMaintenanceRequest::RescheduleType]
1027
+ # Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.
1028
+ # @param schedule_time [::Google::Protobuf::Timestamp, ::Hash]
1029
+ # Timestamp when the maintenance shall be rescheduled to if
1030
+ # reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
1031
+ # example `2012-11-15T16:19:00.094Z`.
1032
+ #
1033
+ # @yield [response, operation] Access the result along with the RPC operation
1034
+ # @yieldparam response [::Gapic::Operation]
1035
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1036
+ #
1037
+ # @return [::Gapic::Operation]
1038
+ #
1039
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1040
+ #
1041
+ # @example Basic example
1042
+ # require "google/cloud/memcache/v1beta2"
1043
+ #
1044
+ # # Create a client object. The client can be reused for multiple calls.
1045
+ # client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new
1046
+ #
1047
+ # # Create a request. To set request fields, pass in keyword arguments.
1048
+ # request = Google::Cloud::Memcache::V1beta2::RescheduleMaintenanceRequest.new
1049
+ #
1050
+ # # Call the reschedule_maintenance method.
1051
+ # result = client.reschedule_maintenance request
1052
+ #
1053
+ # # The returned object is of type Gapic::Operation. You can use it to
1054
+ # # check the status of an operation, cancel it, or wait for results.
1055
+ # # Here is how to wait for a response.
1056
+ # result.wait_until_done! timeout: 60
1057
+ # if result.response?
1058
+ # p result.response
1059
+ # else
1060
+ # puts "No response received."
1061
+ # end
1062
+ #
1063
+ def reschedule_maintenance request, options = nil
1064
+ raise ::ArgumentError, "request must be provided" if request.nil?
1065
+
1066
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memcache::V1beta2::RescheduleMaintenanceRequest
1067
+
1068
+ # Converts hash and nil to an options object
1069
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1070
+
1071
+ # Customize the options with defaults
1072
+ metadata = @config.rpcs.reschedule_maintenance.metadata.to_h
1073
+
1074
+ # Set x-goog-api-client and x-goog-user-project headers
1075
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1076
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1077
+ gapic_version: ::Google::Cloud::Memcache::V1beta2::VERSION
1078
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1079
+
1080
+ header_params = {}
1081
+ if request.instance
1082
+ header_params["instance"] = request.instance
1083
+ end
1084
+
1085
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1086
+ metadata[:"x-goog-request-params"] ||= request_params_header
1087
+
1088
+ options.apply_defaults timeout: @config.rpcs.reschedule_maintenance.timeout,
1089
+ metadata: metadata,
1090
+ retry_policy: @config.rpcs.reschedule_maintenance.retry_policy
1091
+
1092
+ options.apply_defaults timeout: @config.timeout,
1093
+ metadata: @config.metadata,
1094
+ retry_policy: @config.retry_policy
1095
+
1096
+ @cloud_memcache_stub.call_rpc :reschedule_maintenance, request, options: options do |response, operation|
1097
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1098
+ yield response, operation if block_given?
1099
+ return response
1100
+ end
1101
+ rescue ::GRPC::BadStatus => e
1102
+ raise ::Google::Cloud::Error.from_error(e)
1103
+ end
1104
+
989
1105
  ##
990
1106
  # Configuration class for the CloudMemcache API.
991
1107
  #
@@ -1161,6 +1277,11 @@ module Google
1161
1277
  # @return [::Gapic::Config::Method]
1162
1278
  #
1163
1279
  attr_reader :apply_software_update
1280
+ ##
1281
+ # RPC-specific configuration for `reschedule_maintenance`
1282
+ # @return [::Gapic::Config::Method]
1283
+ #
1284
+ attr_reader :reschedule_maintenance
1164
1285
 
1165
1286
  # @private
1166
1287
  def initialize parent_rpcs = nil
@@ -1180,6 +1301,8 @@ module Google
1180
1301
  @apply_parameters = ::Gapic::Config::Method.new apply_parameters_config
1181
1302
  apply_software_update_config = parent_rpcs.apply_software_update if parent_rpcs.respond_to? :apply_software_update
1182
1303
  @apply_software_update = ::Gapic::Config::Method.new apply_software_update_config
1304
+ reschedule_maintenance_config = parent_rpcs.reschedule_maintenance if parent_rpcs.respond_to? :reschedule_maintenance
1305
+ @reschedule_maintenance = ::Gapic::Config::Method.new reschedule_maintenance_config
1183
1306
 
1184
1307
  yield self if block_given?
1185
1308
  end
@@ -158,13 +158,11 @@ module Google
158
158
  # # Call the list_operations method.
159
159
  # result = client.list_operations request
160
160
  #
161
- # # The returned object is of type Gapic::PagedEnumerable. You can
162
- # # iterate over all elements by calling #each, and the enumerable
163
- # # will lazily make API calls to fetch subsequent pages. Other
164
- # # methods are also available for managing paging directly.
165
- # result.each do |response|
161
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
162
+ # # over elements, and API calls will be issued to fetch pages as needed.
163
+ # result.each do |item|
166
164
  # # Each element is of type ::Google::Longrunning::Operation.
167
- # p response
165
+ # p item
168
166
  # end
169
167
  #
170
168
  def list_operations request, options = nil
@@ -253,14 +251,14 @@ module Google
253
251
  # # Call the get_operation method.
254
252
  # result = client.get_operation request
255
253
  #
256
- # # The returned object is of type Gapic::Operation. You can use this
257
- # # object to check the status of an operation, cancel it, or wait
258
- # # for results. Here is how to block until completion:
254
+ # # The returned object is of type Gapic::Operation. You can use it to
255
+ # # check the status of an operation, cancel it, or wait for results.
256
+ # # Here is how to wait for a response.
259
257
  # result.wait_until_done! timeout: 60
260
258
  # if result.response?
261
259
  # p result.response
262
260
  # else
263
- # puts "Error!"
261
+ # puts "No response received."
264
262
  # end
265
263
  #
266
264
  def get_operation request, options = nil
@@ -540,14 +538,14 @@ module Google
540
538
  # # Call the wait_operation method.
541
539
  # result = client.wait_operation request
542
540
  #
543
- # # The returned object is of type Gapic::Operation. You can use this
544
- # # object to check the status of an operation, cancel it, or wait
545
- # # for results. Here is how to block until completion:
541
+ # # The returned object is of type Gapic::Operation. You can use it to
542
+ # # check the status of an operation, cancel it, or wait for results.
543
+ # # Here is how to wait for a response.
546
544
  # result.wait_until_done! timeout: 60
547
545
  # if result.response?
548
546
  # p result.response
549
547
  # else
550
- # puts "Error!"
548
+ # puts "No response received."
551
549
  # end
552
550
  #
553
551
  def wait_operation request, options = nil