google-cloud-memorystore-v1 1.10.0 → 1.11.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.
@@ -1941,6 +1941,799 @@ module Google
1941
1941
  raise ::Google::Cloud::Error.from_error(e)
1942
1942
  end
1943
1943
 
1944
+ ##
1945
+ # Lists all the token auth users for a token based auth enabled instance.
1946
+ #
1947
+ # @overload list_token_auth_users(request, options = nil)
1948
+ # Pass arguments to `list_token_auth_users` via a request object, either of type
1949
+ # {::Google::Cloud::Memorystore::V1::ListTokenAuthUsersRequest} or an equivalent Hash.
1950
+ #
1951
+ # @param request [::Google::Cloud::Memorystore::V1::ListTokenAuthUsersRequest, ::Hash]
1952
+ # A request object representing the call parameters. Required. To specify no
1953
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1954
+ # @param options [::Gapic::CallOptions, ::Hash]
1955
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1956
+ #
1957
+ # @overload list_token_auth_users(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
1958
+ # Pass arguments to `list_token_auth_users` via keyword arguments. Note that at
1959
+ # least one keyword argument is required. To specify no parameters, or to keep all
1960
+ # the default parameter values, pass an empty Hash as a request object (see above).
1961
+ #
1962
+ # @param parent [::String]
1963
+ # Required. The parent to list token auth users from.
1964
+ # Format: projects/\\{project}/locations/\\{location}/instances/\\{instance}
1965
+ # @param page_size [::Integer]
1966
+ # Optional. The maximum number of items to return. The maximum value is 1000;
1967
+ # values above 1000 will be coerced to 1000. If not specified, a default
1968
+ # value of 1000 will be used by the service. Regardless of the page_size
1969
+ # value, the response may include a partial list and a caller should only
1970
+ # rely on response's `next_page_token` to determine if there are more token
1971
+ # auth users left to be queried.
1972
+ # @param page_token [::String]
1973
+ # Optional. The `next_page_token` value returned from a previous
1974
+ # `ListTokenAuthUsers` request, if any.
1975
+ # @param filter [::String]
1976
+ # Optional. Expression for filtering results.
1977
+ # @param order_by [::String]
1978
+ # Optional. Sort results by a defined order.
1979
+ #
1980
+ # @yield [response, operation] Access the result along with the RPC operation
1981
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Memorystore::V1::TokenAuthUser>]
1982
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1983
+ #
1984
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Memorystore::V1::TokenAuthUser>]
1985
+ #
1986
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1987
+ #
1988
+ # @example Basic example
1989
+ # require "google/cloud/memorystore/v1"
1990
+ #
1991
+ # # Create a client object. The client can be reused for multiple calls.
1992
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Client.new
1993
+ #
1994
+ # # Create a request. To set request fields, pass in keyword arguments.
1995
+ # request = Google::Cloud::Memorystore::V1::ListTokenAuthUsersRequest.new
1996
+ #
1997
+ # # Call the list_token_auth_users method.
1998
+ # result = client.list_token_auth_users request
1999
+ #
2000
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2001
+ # # over elements, and API calls will be issued to fetch pages as needed.
2002
+ # result.each do |item|
2003
+ # # Each element is of type ::Google::Cloud::Memorystore::V1::TokenAuthUser.
2004
+ # p item
2005
+ # end
2006
+ #
2007
+ def list_token_auth_users request, options = nil
2008
+ raise ::ArgumentError, "request must be provided" if request.nil?
2009
+
2010
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::ListTokenAuthUsersRequest
2011
+
2012
+ # Converts hash and nil to an options object
2013
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2014
+
2015
+ # Customize the options with defaults
2016
+ metadata = @config.rpcs.list_token_auth_users.metadata.to_h
2017
+
2018
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2019
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2020
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2021
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION
2022
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2023
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2024
+
2025
+ header_params = {}
2026
+ if request.parent
2027
+ header_params["parent"] = request.parent
2028
+ end
2029
+
2030
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2031
+ metadata[:"x-goog-request-params"] ||= request_params_header
2032
+
2033
+ options.apply_defaults timeout: @config.rpcs.list_token_auth_users.timeout,
2034
+ metadata: metadata,
2035
+ retry_policy: @config.rpcs.list_token_auth_users.retry_policy
2036
+
2037
+ options.apply_defaults timeout: @config.timeout,
2038
+ metadata: @config.metadata,
2039
+ retry_policy: @config.retry_policy
2040
+
2041
+ @memorystore_stub.call_rpc :list_token_auth_users, request, options: options do |response, operation|
2042
+ response = ::Gapic::PagedEnumerable.new @memorystore_stub, :list_token_auth_users, request, response, operation, options
2043
+ yield response, operation if block_given?
2044
+ throw :response, response
2045
+ end
2046
+ rescue ::GRPC::BadStatus => e
2047
+ raise ::Google::Cloud::Error.from_error(e)
2048
+ end
2049
+
2050
+ ##
2051
+ # Gets a specific token auth user for a token based auth enabled instance.
2052
+ #
2053
+ # @overload get_token_auth_user(request, options = nil)
2054
+ # Pass arguments to `get_token_auth_user` via a request object, either of type
2055
+ # {::Google::Cloud::Memorystore::V1::GetTokenAuthUserRequest} or an equivalent Hash.
2056
+ #
2057
+ # @param request [::Google::Cloud::Memorystore::V1::GetTokenAuthUserRequest, ::Hash]
2058
+ # A request object representing the call parameters. Required. To specify no
2059
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2060
+ # @param options [::Gapic::CallOptions, ::Hash]
2061
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2062
+ #
2063
+ # @overload get_token_auth_user(name: nil)
2064
+ # Pass arguments to `get_token_auth_user` via keyword arguments. Note that at
2065
+ # least one keyword argument is required. To specify no parameters, or to keep all
2066
+ # the default parameter values, pass an empty Hash as a request object (see above).
2067
+ #
2068
+ # @param name [::String]
2069
+ # Required. The name of token auth user for a basic auth enabled instance.
2070
+ # Format:
2071
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}/tokenAuthUsers/\\{token_auth_user}
2072
+ #
2073
+ # @yield [response, operation] Access the result along with the RPC operation
2074
+ # @yieldparam response [::Google::Cloud::Memorystore::V1::TokenAuthUser]
2075
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2076
+ #
2077
+ # @return [::Google::Cloud::Memorystore::V1::TokenAuthUser]
2078
+ #
2079
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2080
+ #
2081
+ # @example Basic example
2082
+ # require "google/cloud/memorystore/v1"
2083
+ #
2084
+ # # Create a client object. The client can be reused for multiple calls.
2085
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Client.new
2086
+ #
2087
+ # # Create a request. To set request fields, pass in keyword arguments.
2088
+ # request = Google::Cloud::Memorystore::V1::GetTokenAuthUserRequest.new
2089
+ #
2090
+ # # Call the get_token_auth_user method.
2091
+ # result = client.get_token_auth_user request
2092
+ #
2093
+ # # The returned object is of type Google::Cloud::Memorystore::V1::TokenAuthUser.
2094
+ # p result
2095
+ #
2096
+ def get_token_auth_user request, options = nil
2097
+ raise ::ArgumentError, "request must be provided" if request.nil?
2098
+
2099
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::GetTokenAuthUserRequest
2100
+
2101
+ # Converts hash and nil to an options object
2102
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2103
+
2104
+ # Customize the options with defaults
2105
+ metadata = @config.rpcs.get_token_auth_user.metadata.to_h
2106
+
2107
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2108
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2109
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2110
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION
2111
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2112
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2113
+
2114
+ header_params = {}
2115
+ if request.name
2116
+ header_params["name"] = request.name
2117
+ end
2118
+
2119
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2120
+ metadata[:"x-goog-request-params"] ||= request_params_header
2121
+
2122
+ options.apply_defaults timeout: @config.rpcs.get_token_auth_user.timeout,
2123
+ metadata: metadata,
2124
+ retry_policy: @config.rpcs.get_token_auth_user.retry_policy
2125
+
2126
+ options.apply_defaults timeout: @config.timeout,
2127
+ metadata: @config.metadata,
2128
+ retry_policy: @config.retry_policy
2129
+
2130
+ @memorystore_stub.call_rpc :get_token_auth_user, request, options: options do |response, operation|
2131
+ yield response, operation if block_given?
2132
+ end
2133
+ rescue ::GRPC::BadStatus => e
2134
+ raise ::Google::Cloud::Error.from_error(e)
2135
+ end
2136
+
2137
+ ##
2138
+ # Lists all the auth tokens for a specific token auth user.
2139
+ #
2140
+ # @overload list_auth_tokens(request, options = nil)
2141
+ # Pass arguments to `list_auth_tokens` via a request object, either of type
2142
+ # {::Google::Cloud::Memorystore::V1::ListAuthTokensRequest} or an equivalent Hash.
2143
+ #
2144
+ # @param request [::Google::Cloud::Memorystore::V1::ListAuthTokensRequest, ::Hash]
2145
+ # A request object representing the call parameters. Required. To specify no
2146
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2147
+ # @param options [::Gapic::CallOptions, ::Hash]
2148
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2149
+ #
2150
+ # @overload list_auth_tokens(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
2151
+ # Pass arguments to `list_auth_tokens` via keyword arguments. Note that at
2152
+ # least one keyword argument is required. To specify no parameters, or to keep all
2153
+ # the default parameter values, pass an empty Hash as a request object (see above).
2154
+ #
2155
+ # @param parent [::String]
2156
+ # Required. The parent to list auth tokens from.
2157
+ # Format:
2158
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}/tokenAuthUsers/\\{token_auth_user}
2159
+ # @param page_size [::Integer]
2160
+ # Optional. The maximum number of items to return. The maximum value is 1000;
2161
+ # values above 1000 will be coerced to 1000.
2162
+ #
2163
+ # If not specified, a default value of 1000 will be used by the service.
2164
+ # Regardless of the page_size value, the response may include a partial list
2165
+ # and a caller should only rely on response's
2166
+ # `next_page_token`
2167
+ # to determine if there are more auth tokens left to be queried.
2168
+ # @param page_token [::String]
2169
+ # Optional. The `next_page_token` value returned from a previous
2170
+ # `ListAuthTokens` request, if any.
2171
+ # @param filter [::String]
2172
+ # Optional. Expression for filtering results.
2173
+ # @param order_by [::String]
2174
+ # Optional. Sort results by a defined order.
2175
+ #
2176
+ # @yield [response, operation] Access the result along with the RPC operation
2177
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Memorystore::V1::AuthToken>]
2178
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2179
+ #
2180
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Memorystore::V1::AuthToken>]
2181
+ #
2182
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2183
+ #
2184
+ # @example Basic example
2185
+ # require "google/cloud/memorystore/v1"
2186
+ #
2187
+ # # Create a client object. The client can be reused for multiple calls.
2188
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Client.new
2189
+ #
2190
+ # # Create a request. To set request fields, pass in keyword arguments.
2191
+ # request = Google::Cloud::Memorystore::V1::ListAuthTokensRequest.new
2192
+ #
2193
+ # # Call the list_auth_tokens method.
2194
+ # result = client.list_auth_tokens request
2195
+ #
2196
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2197
+ # # over elements, and API calls will be issued to fetch pages as needed.
2198
+ # result.each do |item|
2199
+ # # Each element is of type ::Google::Cloud::Memorystore::V1::AuthToken.
2200
+ # p item
2201
+ # end
2202
+ #
2203
+ def list_auth_tokens request, options = nil
2204
+ raise ::ArgumentError, "request must be provided" if request.nil?
2205
+
2206
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::ListAuthTokensRequest
2207
+
2208
+ # Converts hash and nil to an options object
2209
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2210
+
2211
+ # Customize the options with defaults
2212
+ metadata = @config.rpcs.list_auth_tokens.metadata.to_h
2213
+
2214
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2215
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2216
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2217
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION
2218
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2219
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2220
+
2221
+ header_params = {}
2222
+ if request.parent
2223
+ header_params["parent"] = request.parent
2224
+ end
2225
+
2226
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2227
+ metadata[:"x-goog-request-params"] ||= request_params_header
2228
+
2229
+ options.apply_defaults timeout: @config.rpcs.list_auth_tokens.timeout,
2230
+ metadata: metadata,
2231
+ retry_policy: @config.rpcs.list_auth_tokens.retry_policy
2232
+
2233
+ options.apply_defaults timeout: @config.timeout,
2234
+ metadata: @config.metadata,
2235
+ retry_policy: @config.retry_policy
2236
+
2237
+ @memorystore_stub.call_rpc :list_auth_tokens, request, options: options do |response, operation|
2238
+ response = ::Gapic::PagedEnumerable.new @memorystore_stub, :list_auth_tokens, request, response, operation, options
2239
+ yield response, operation if block_given?
2240
+ throw :response, response
2241
+ end
2242
+ rescue ::GRPC::BadStatus => e
2243
+ raise ::Google::Cloud::Error.from_error(e)
2244
+ end
2245
+
2246
+ ##
2247
+ # Gets a token based auth enabled instance's auth token for a given user.
2248
+ #
2249
+ # @overload get_auth_token(request, options = nil)
2250
+ # Pass arguments to `get_auth_token` via a request object, either of type
2251
+ # {::Google::Cloud::Memorystore::V1::GetAuthTokenRequest} or an equivalent Hash.
2252
+ #
2253
+ # @param request [::Google::Cloud::Memorystore::V1::GetAuthTokenRequest, ::Hash]
2254
+ # A request object representing the call parameters. Required. To specify no
2255
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2256
+ # @param options [::Gapic::CallOptions, ::Hash]
2257
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2258
+ #
2259
+ # @overload get_auth_token(name: nil)
2260
+ # Pass arguments to `get_auth_token` via keyword arguments. Note that at
2261
+ # least one keyword argument is required. To specify no parameters, or to keep all
2262
+ # the default parameter values, pass an empty Hash as a request object (see above).
2263
+ #
2264
+ # @param name [::String]
2265
+ # Required. The name of token auth user for a token auth enabled instance.
2266
+ # Format:
2267
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}/tokenAuthUsers/\\{token_auth_user}/authTokens/\\{auth_token}
2268
+ #
2269
+ # @yield [response, operation] Access the result along with the RPC operation
2270
+ # @yieldparam response [::Google::Cloud::Memorystore::V1::AuthToken]
2271
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2272
+ #
2273
+ # @return [::Google::Cloud::Memorystore::V1::AuthToken]
2274
+ #
2275
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2276
+ #
2277
+ # @example Basic example
2278
+ # require "google/cloud/memorystore/v1"
2279
+ #
2280
+ # # Create a client object. The client can be reused for multiple calls.
2281
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Client.new
2282
+ #
2283
+ # # Create a request. To set request fields, pass in keyword arguments.
2284
+ # request = Google::Cloud::Memorystore::V1::GetAuthTokenRequest.new
2285
+ #
2286
+ # # Call the get_auth_token method.
2287
+ # result = client.get_auth_token request
2288
+ #
2289
+ # # The returned object is of type Google::Cloud::Memorystore::V1::AuthToken.
2290
+ # p result
2291
+ #
2292
+ def get_auth_token request, options = nil
2293
+ raise ::ArgumentError, "request must be provided" if request.nil?
2294
+
2295
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::GetAuthTokenRequest
2296
+
2297
+ # Converts hash and nil to an options object
2298
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2299
+
2300
+ # Customize the options with defaults
2301
+ metadata = @config.rpcs.get_auth_token.metadata.to_h
2302
+
2303
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2304
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2305
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2306
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION
2307
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2308
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2309
+
2310
+ header_params = {}
2311
+ if request.name
2312
+ header_params["name"] = request.name
2313
+ end
2314
+
2315
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2316
+ metadata[:"x-goog-request-params"] ||= request_params_header
2317
+
2318
+ options.apply_defaults timeout: @config.rpcs.get_auth_token.timeout,
2319
+ metadata: metadata,
2320
+ retry_policy: @config.rpcs.get_auth_token.retry_policy
2321
+
2322
+ options.apply_defaults timeout: @config.timeout,
2323
+ metadata: @config.metadata,
2324
+ retry_policy: @config.retry_policy
2325
+
2326
+ @memorystore_stub.call_rpc :get_auth_token, request, options: options do |response, operation|
2327
+ yield response, operation if block_given?
2328
+ end
2329
+ rescue ::GRPC::BadStatus => e
2330
+ raise ::Google::Cloud::Error.from_error(e)
2331
+ end
2332
+
2333
+ ##
2334
+ # Adds a token auth user for a token based auth enabled instance.
2335
+ #
2336
+ # @overload add_token_auth_user(request, options = nil)
2337
+ # Pass arguments to `add_token_auth_user` via a request object, either of type
2338
+ # {::Google::Cloud::Memorystore::V1::AddTokenAuthUserRequest} or an equivalent Hash.
2339
+ #
2340
+ # @param request [::Google::Cloud::Memorystore::V1::AddTokenAuthUserRequest, ::Hash]
2341
+ # A request object representing the call parameters. Required. To specify no
2342
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2343
+ # @param options [::Gapic::CallOptions, ::Hash]
2344
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2345
+ #
2346
+ # @overload add_token_auth_user(instance: nil, token_auth_user: nil)
2347
+ # Pass arguments to `add_token_auth_user` via keyword arguments. Note that at
2348
+ # least one keyword argument is required. To specify no parameters, or to keep all
2349
+ # the default parameter values, pass an empty Hash as a request object (see above).
2350
+ #
2351
+ # @param instance [::String]
2352
+ # Required. The instance resource that this token auth user will be added
2353
+ # for. Format: projects/\\{project}/locations/\\{location}/instances/\\{instance}
2354
+ # @param token_auth_user [::String]
2355
+ # Required. The name of the token auth user to add.
2356
+ #
2357
+ # @yield [response, operation] Access the result along with the RPC operation
2358
+ # @yieldparam response [::Gapic::Operation]
2359
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2360
+ #
2361
+ # @return [::Gapic::Operation]
2362
+ #
2363
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2364
+ #
2365
+ # @example Basic example
2366
+ # require "google/cloud/memorystore/v1"
2367
+ #
2368
+ # # Create a client object. The client can be reused for multiple calls.
2369
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Client.new
2370
+ #
2371
+ # # Create a request. To set request fields, pass in keyword arguments.
2372
+ # request = Google::Cloud::Memorystore::V1::AddTokenAuthUserRequest.new
2373
+ #
2374
+ # # Call the add_token_auth_user method.
2375
+ # result = client.add_token_auth_user request
2376
+ #
2377
+ # # The returned object is of type Gapic::Operation. You can use it to
2378
+ # # check the status of an operation, cancel it, or wait for results.
2379
+ # # Here is how to wait for a response.
2380
+ # result.wait_until_done! timeout: 60
2381
+ # if result.response?
2382
+ # p result.response
2383
+ # else
2384
+ # puts "No response received."
2385
+ # end
2386
+ #
2387
+ def add_token_auth_user request, options = nil
2388
+ raise ::ArgumentError, "request must be provided" if request.nil?
2389
+
2390
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::AddTokenAuthUserRequest
2391
+
2392
+ # Converts hash and nil to an options object
2393
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2394
+
2395
+ # Customize the options with defaults
2396
+ metadata = @config.rpcs.add_token_auth_user.metadata.to_h
2397
+
2398
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2399
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2400
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2401
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION
2402
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2403
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2404
+
2405
+ header_params = {}
2406
+ if request.instance
2407
+ header_params["instance"] = request.instance
2408
+ end
2409
+
2410
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2411
+ metadata[:"x-goog-request-params"] ||= request_params_header
2412
+
2413
+ options.apply_defaults timeout: @config.rpcs.add_token_auth_user.timeout,
2414
+ metadata: metadata,
2415
+ retry_policy: @config.rpcs.add_token_auth_user.retry_policy
2416
+
2417
+ options.apply_defaults timeout: @config.timeout,
2418
+ metadata: @config.metadata,
2419
+ retry_policy: @config.retry_policy
2420
+
2421
+ @memorystore_stub.call_rpc :add_token_auth_user, request, options: options do |response, operation|
2422
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2423
+ yield response, operation if block_given?
2424
+ throw :response, response
2425
+ end
2426
+ rescue ::GRPC::BadStatus => e
2427
+ raise ::Google::Cloud::Error.from_error(e)
2428
+ end
2429
+
2430
+ ##
2431
+ # Deletes a token auth user for a token based auth enabled instance.
2432
+ #
2433
+ # @overload delete_token_auth_user(request, options = nil)
2434
+ # Pass arguments to `delete_token_auth_user` via a request object, either of type
2435
+ # {::Google::Cloud::Memorystore::V1::DeleteTokenAuthUserRequest} or an equivalent Hash.
2436
+ #
2437
+ # @param request [::Google::Cloud::Memorystore::V1::DeleteTokenAuthUserRequest, ::Hash]
2438
+ # A request object representing the call parameters. Required. To specify no
2439
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2440
+ # @param options [::Gapic::CallOptions, ::Hash]
2441
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2442
+ #
2443
+ # @overload delete_token_auth_user(name: nil, request_id: nil, force: nil)
2444
+ # Pass arguments to `delete_token_auth_user` via keyword arguments. Note that at
2445
+ # least one keyword argument is required. To specify no parameters, or to keep all
2446
+ # the default parameter values, pass an empty Hash as a request object (see above).
2447
+ #
2448
+ # @param name [::String]
2449
+ # Required. The name of the token auth user to delete.
2450
+ # Format:
2451
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}/tokenAuthUsers/\\{token_auth_user}
2452
+ # @param request_id [::String]
2453
+ # Optional. An optional request ID to identify requests. Specify a unique
2454
+ # request ID so that if you must retry your request, the server will know to
2455
+ # ignore the request if it has already been completed. The server will
2456
+ # guarantee that for at least 60 minutes after the first request.
2457
+ #
2458
+ # For example, consider a situation where you make an initial request and the
2459
+ # request times out. If you make the request again with the same request
2460
+ # ID, the server can check if original operation with the same request ID
2461
+ # was received, and if so, will ignore the second request. This prevents
2462
+ # clients from accidentally creating duplicate commitments.
2463
+ #
2464
+ # The request ID must be a valid UUID with the exception that zero UUID is
2465
+ # not supported (00000000-0000-0000-0000-000000000000).
2466
+ # @param force [::Boolean]
2467
+ # Optional. If set to true, any auth tokens from this user will also be
2468
+ # deleted. Otherwise, the request will only work if the user has no auth
2469
+ # tokens.
2470
+ #
2471
+ # @yield [response, operation] Access the result along with the RPC operation
2472
+ # @yieldparam response [::Gapic::Operation]
2473
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2474
+ #
2475
+ # @return [::Gapic::Operation]
2476
+ #
2477
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2478
+ #
2479
+ # @example Basic example
2480
+ # require "google/cloud/memorystore/v1"
2481
+ #
2482
+ # # Create a client object. The client can be reused for multiple calls.
2483
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Client.new
2484
+ #
2485
+ # # Create a request. To set request fields, pass in keyword arguments.
2486
+ # request = Google::Cloud::Memorystore::V1::DeleteTokenAuthUserRequest.new
2487
+ #
2488
+ # # Call the delete_token_auth_user method.
2489
+ # result = client.delete_token_auth_user request
2490
+ #
2491
+ # # The returned object is of type Gapic::Operation. You can use it to
2492
+ # # check the status of an operation, cancel it, or wait for results.
2493
+ # # Here is how to wait for a response.
2494
+ # result.wait_until_done! timeout: 60
2495
+ # if result.response?
2496
+ # p result.response
2497
+ # else
2498
+ # puts "No response received."
2499
+ # end
2500
+ #
2501
+ def delete_token_auth_user request, options = nil
2502
+ raise ::ArgumentError, "request must be provided" if request.nil?
2503
+
2504
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::DeleteTokenAuthUserRequest
2505
+
2506
+ # Converts hash and nil to an options object
2507
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2508
+
2509
+ # Customize the options with defaults
2510
+ metadata = @config.rpcs.delete_token_auth_user.metadata.to_h
2511
+
2512
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2513
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2514
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2515
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION
2516
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2517
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2518
+
2519
+ header_params = {}
2520
+ if request.name
2521
+ header_params["name"] = request.name
2522
+ end
2523
+
2524
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2525
+ metadata[:"x-goog-request-params"] ||= request_params_header
2526
+
2527
+ options.apply_defaults timeout: @config.rpcs.delete_token_auth_user.timeout,
2528
+ metadata: metadata,
2529
+ retry_policy: @config.rpcs.delete_token_auth_user.retry_policy
2530
+
2531
+ options.apply_defaults timeout: @config.timeout,
2532
+ metadata: @config.metadata,
2533
+ retry_policy: @config.retry_policy
2534
+
2535
+ @memorystore_stub.call_rpc :delete_token_auth_user, request, options: options do |response, operation|
2536
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2537
+ yield response, operation if block_given?
2538
+ throw :response, response
2539
+ end
2540
+ rescue ::GRPC::BadStatus => e
2541
+ raise ::Google::Cloud::Error.from_error(e)
2542
+ end
2543
+
2544
+ ##
2545
+ # Adds a token for a user of a token based auth enabled instance.
2546
+ #
2547
+ # @overload add_auth_token(request, options = nil)
2548
+ # Pass arguments to `add_auth_token` via a request object, either of type
2549
+ # {::Google::Cloud::Memorystore::V1::AddAuthTokenRequest} or an equivalent Hash.
2550
+ #
2551
+ # @param request [::Google::Cloud::Memorystore::V1::AddAuthTokenRequest, ::Hash]
2552
+ # A request object representing the call parameters. Required. To specify no
2553
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2554
+ # @param options [::Gapic::CallOptions, ::Hash]
2555
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2556
+ #
2557
+ # @overload add_auth_token(token_auth_user: nil, auth_token: nil)
2558
+ # Pass arguments to `add_auth_token` via keyword arguments. Note that at
2559
+ # least one keyword argument is required. To specify no parameters, or to keep all
2560
+ # the default parameter values, pass an empty Hash as a request object (see above).
2561
+ #
2562
+ # @param token_auth_user [::String]
2563
+ # Required. The name of the token auth user resource that this token will be
2564
+ # added for.
2565
+ # @param auth_token [::Google::Cloud::Memorystore::V1::AuthToken, ::Hash]
2566
+ # Required. The auth token to add.
2567
+ #
2568
+ # @yield [response, operation] Access the result along with the RPC operation
2569
+ # @yieldparam response [::Gapic::Operation]
2570
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2571
+ #
2572
+ # @return [::Gapic::Operation]
2573
+ #
2574
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2575
+ #
2576
+ # @example Basic example
2577
+ # require "google/cloud/memorystore/v1"
2578
+ #
2579
+ # # Create a client object. The client can be reused for multiple calls.
2580
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Client.new
2581
+ #
2582
+ # # Create a request. To set request fields, pass in keyword arguments.
2583
+ # request = Google::Cloud::Memorystore::V1::AddAuthTokenRequest.new
2584
+ #
2585
+ # # Call the add_auth_token method.
2586
+ # result = client.add_auth_token request
2587
+ #
2588
+ # # The returned object is of type Gapic::Operation. You can use it to
2589
+ # # check the status of an operation, cancel it, or wait for results.
2590
+ # # Here is how to wait for a response.
2591
+ # result.wait_until_done! timeout: 60
2592
+ # if result.response?
2593
+ # p result.response
2594
+ # else
2595
+ # puts "No response received."
2596
+ # end
2597
+ #
2598
+ def add_auth_token request, options = nil
2599
+ raise ::ArgumentError, "request must be provided" if request.nil?
2600
+
2601
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::AddAuthTokenRequest
2602
+
2603
+ # Converts hash and nil to an options object
2604
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2605
+
2606
+ # Customize the options with defaults
2607
+ metadata = @config.rpcs.add_auth_token.metadata.to_h
2608
+
2609
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2610
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2611
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2612
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION
2613
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2614
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2615
+
2616
+ header_params = {}
2617
+ if request.token_auth_user
2618
+ header_params["token_auth_user"] = request.token_auth_user
2619
+ end
2620
+
2621
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2622
+ metadata[:"x-goog-request-params"] ||= request_params_header
2623
+
2624
+ options.apply_defaults timeout: @config.rpcs.add_auth_token.timeout,
2625
+ metadata: metadata,
2626
+ retry_policy: @config.rpcs.add_auth_token.retry_policy
2627
+
2628
+ options.apply_defaults timeout: @config.timeout,
2629
+ metadata: @config.metadata,
2630
+ retry_policy: @config.retry_policy
2631
+
2632
+ @memorystore_stub.call_rpc :add_auth_token, request, options: options do |response, operation|
2633
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2634
+ yield response, operation if block_given?
2635
+ throw :response, response
2636
+ end
2637
+ rescue ::GRPC::BadStatus => e
2638
+ raise ::Google::Cloud::Error.from_error(e)
2639
+ end
2640
+
2641
+ ##
2642
+ # Deletes a token for a user of a token based auth enabled instance.
2643
+ #
2644
+ # @overload delete_auth_token(request, options = nil)
2645
+ # Pass arguments to `delete_auth_token` via a request object, either of type
2646
+ # {::Google::Cloud::Memorystore::V1::DeleteAuthTokenRequest} or an equivalent Hash.
2647
+ #
2648
+ # @param request [::Google::Cloud::Memorystore::V1::DeleteAuthTokenRequest, ::Hash]
2649
+ # A request object representing the call parameters. Required. To specify no
2650
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2651
+ # @param options [::Gapic::CallOptions, ::Hash]
2652
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2653
+ #
2654
+ # @overload delete_auth_token(name: nil)
2655
+ # Pass arguments to `delete_auth_token` via keyword arguments. Note that at
2656
+ # least one keyword argument is required. To specify no parameters, or to keep all
2657
+ # the default parameter values, pass an empty Hash as a request object (see above).
2658
+ #
2659
+ # @param name [::String]
2660
+ # Required. The name of the token auth user resource that this token will be
2661
+ # deleted from. Format:
2662
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}/tokenAuthUsers/\\{token_auth_user}/authTokens/\\{name}
2663
+ #
2664
+ # @yield [response, operation] Access the result along with the RPC operation
2665
+ # @yieldparam response [::Gapic::Operation]
2666
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2667
+ #
2668
+ # @return [::Gapic::Operation]
2669
+ #
2670
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2671
+ #
2672
+ # @example Basic example
2673
+ # require "google/cloud/memorystore/v1"
2674
+ #
2675
+ # # Create a client object. The client can be reused for multiple calls.
2676
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Client.new
2677
+ #
2678
+ # # Create a request. To set request fields, pass in keyword arguments.
2679
+ # request = Google::Cloud::Memorystore::V1::DeleteAuthTokenRequest.new
2680
+ #
2681
+ # # Call the delete_auth_token method.
2682
+ # result = client.delete_auth_token request
2683
+ #
2684
+ # # The returned object is of type Gapic::Operation. You can use it to
2685
+ # # check the status of an operation, cancel it, or wait for results.
2686
+ # # Here is how to wait for a response.
2687
+ # result.wait_until_done! timeout: 60
2688
+ # if result.response?
2689
+ # p result.response
2690
+ # else
2691
+ # puts "No response received."
2692
+ # end
2693
+ #
2694
+ def delete_auth_token request, options = nil
2695
+ raise ::ArgumentError, "request must be provided" if request.nil?
2696
+
2697
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::DeleteAuthTokenRequest
2698
+
2699
+ # Converts hash and nil to an options object
2700
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2701
+
2702
+ # Customize the options with defaults
2703
+ metadata = @config.rpcs.delete_auth_token.metadata.to_h
2704
+
2705
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2706
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2707
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2708
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION
2709
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2710
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2711
+
2712
+ header_params = {}
2713
+ if request.name
2714
+ header_params["name"] = request.name
2715
+ end
2716
+
2717
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2718
+ metadata[:"x-goog-request-params"] ||= request_params_header
2719
+
2720
+ options.apply_defaults timeout: @config.rpcs.delete_auth_token.timeout,
2721
+ metadata: metadata,
2722
+ retry_policy: @config.rpcs.delete_auth_token.retry_policy
2723
+
2724
+ options.apply_defaults timeout: @config.timeout,
2725
+ metadata: @config.metadata,
2726
+ retry_policy: @config.retry_policy
2727
+
2728
+ @memorystore_stub.call_rpc :delete_auth_token, request, options: options do |response, operation|
2729
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2730
+ yield response, operation if block_given?
2731
+ throw :response, response
2732
+ end
2733
+ rescue ::GRPC::BadStatus => e
2734
+ raise ::Google::Cloud::Error.from_error(e)
2735
+ end
2736
+
1944
2737
  ##
1945
2738
  # Configuration class for the Memorystore API.
1946
2739
  #
@@ -2211,6 +3004,46 @@ module Google
2211
3004
  # @return [::Gapic::Config::Method]
2212
3005
  #
2213
3006
  attr_reader :finish_migration
3007
+ ##
3008
+ # RPC-specific configuration for `list_token_auth_users`
3009
+ # @return [::Gapic::Config::Method]
3010
+ #
3011
+ attr_reader :list_token_auth_users
3012
+ ##
3013
+ # RPC-specific configuration for `get_token_auth_user`
3014
+ # @return [::Gapic::Config::Method]
3015
+ #
3016
+ attr_reader :get_token_auth_user
3017
+ ##
3018
+ # RPC-specific configuration for `list_auth_tokens`
3019
+ # @return [::Gapic::Config::Method]
3020
+ #
3021
+ attr_reader :list_auth_tokens
3022
+ ##
3023
+ # RPC-specific configuration for `get_auth_token`
3024
+ # @return [::Gapic::Config::Method]
3025
+ #
3026
+ attr_reader :get_auth_token
3027
+ ##
3028
+ # RPC-specific configuration for `add_token_auth_user`
3029
+ # @return [::Gapic::Config::Method]
3030
+ #
3031
+ attr_reader :add_token_auth_user
3032
+ ##
3033
+ # RPC-specific configuration for `delete_token_auth_user`
3034
+ # @return [::Gapic::Config::Method]
3035
+ #
3036
+ attr_reader :delete_token_auth_user
3037
+ ##
3038
+ # RPC-specific configuration for `add_auth_token`
3039
+ # @return [::Gapic::Config::Method]
3040
+ #
3041
+ attr_reader :add_auth_token
3042
+ ##
3043
+ # RPC-specific configuration for `delete_auth_token`
3044
+ # @return [::Gapic::Config::Method]
3045
+ #
3046
+ attr_reader :delete_auth_token
2214
3047
 
2215
3048
  # @private
2216
3049
  def initialize parent_rpcs = nil
@@ -2248,6 +3081,22 @@ module Google
2248
3081
  @start_migration = ::Gapic::Config::Method.new start_migration_config
2249
3082
  finish_migration_config = parent_rpcs.finish_migration if parent_rpcs.respond_to? :finish_migration
2250
3083
  @finish_migration = ::Gapic::Config::Method.new finish_migration_config
3084
+ list_token_auth_users_config = parent_rpcs.list_token_auth_users if parent_rpcs.respond_to? :list_token_auth_users
3085
+ @list_token_auth_users = ::Gapic::Config::Method.new list_token_auth_users_config
3086
+ get_token_auth_user_config = parent_rpcs.get_token_auth_user if parent_rpcs.respond_to? :get_token_auth_user
3087
+ @get_token_auth_user = ::Gapic::Config::Method.new get_token_auth_user_config
3088
+ list_auth_tokens_config = parent_rpcs.list_auth_tokens if parent_rpcs.respond_to? :list_auth_tokens
3089
+ @list_auth_tokens = ::Gapic::Config::Method.new list_auth_tokens_config
3090
+ get_auth_token_config = parent_rpcs.get_auth_token if parent_rpcs.respond_to? :get_auth_token
3091
+ @get_auth_token = ::Gapic::Config::Method.new get_auth_token_config
3092
+ add_token_auth_user_config = parent_rpcs.add_token_auth_user if parent_rpcs.respond_to? :add_token_auth_user
3093
+ @add_token_auth_user = ::Gapic::Config::Method.new add_token_auth_user_config
3094
+ delete_token_auth_user_config = parent_rpcs.delete_token_auth_user if parent_rpcs.respond_to? :delete_token_auth_user
3095
+ @delete_token_auth_user = ::Gapic::Config::Method.new delete_token_auth_user_config
3096
+ add_auth_token_config = parent_rpcs.add_auth_token if parent_rpcs.respond_to? :add_auth_token
3097
+ @add_auth_token = ::Gapic::Config::Method.new add_auth_token_config
3098
+ delete_auth_token_config = parent_rpcs.delete_auth_token if parent_rpcs.respond_to? :delete_auth_token
3099
+ @delete_auth_token = ::Gapic::Config::Method.new delete_auth_token_config
2251
3100
 
2252
3101
  yield self if block_given?
2253
3102
  end