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.
@@ -1816,6 +1816,743 @@ module Google
1816
1816
  raise ::Google::Cloud::Error.from_error(e)
1817
1817
  end
1818
1818
 
1819
+ ##
1820
+ # Lists all the token auth users for a token based auth enabled instance.
1821
+ #
1822
+ # @overload list_token_auth_users(request, options = nil)
1823
+ # Pass arguments to `list_token_auth_users` via a request object, either of type
1824
+ # {::Google::Cloud::Memorystore::V1::ListTokenAuthUsersRequest} or an equivalent Hash.
1825
+ #
1826
+ # @param request [::Google::Cloud::Memorystore::V1::ListTokenAuthUsersRequest, ::Hash]
1827
+ # A request object representing the call parameters. Required. To specify no
1828
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1829
+ # @param options [::Gapic::CallOptions, ::Hash]
1830
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1831
+ #
1832
+ # @overload list_token_auth_users(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
1833
+ # Pass arguments to `list_token_auth_users` via keyword arguments. Note that at
1834
+ # least one keyword argument is required. To specify no parameters, or to keep all
1835
+ # the default parameter values, pass an empty Hash as a request object (see above).
1836
+ #
1837
+ # @param parent [::String]
1838
+ # Required. The parent to list token auth users from.
1839
+ # Format: projects/\\{project}/locations/\\{location}/instances/\\{instance}
1840
+ # @param page_size [::Integer]
1841
+ # Optional. The maximum number of items to return. The maximum value is 1000;
1842
+ # values above 1000 will be coerced to 1000. If not specified, a default
1843
+ # value of 1000 will be used by the service. Regardless of the page_size
1844
+ # value, the response may include a partial list and a caller should only
1845
+ # rely on response's `next_page_token` to determine if there are more token
1846
+ # auth users left to be queried.
1847
+ # @param page_token [::String]
1848
+ # Optional. The `next_page_token` value returned from a previous
1849
+ # `ListTokenAuthUsers` request, if any.
1850
+ # @param filter [::String]
1851
+ # Optional. Expression for filtering results.
1852
+ # @param order_by [::String]
1853
+ # Optional. Sort results by a defined order.
1854
+ # @yield [result, operation] Access the result along with the TransportOperation object
1855
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Memorystore::V1::TokenAuthUser>]
1856
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1857
+ #
1858
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Memorystore::V1::TokenAuthUser>]
1859
+ #
1860
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1861
+ #
1862
+ # @example Basic example
1863
+ # require "google/cloud/memorystore/v1"
1864
+ #
1865
+ # # Create a client object. The client can be reused for multiple calls.
1866
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Rest::Client.new
1867
+ #
1868
+ # # Create a request. To set request fields, pass in keyword arguments.
1869
+ # request = Google::Cloud::Memorystore::V1::ListTokenAuthUsersRequest.new
1870
+ #
1871
+ # # Call the list_token_auth_users method.
1872
+ # result = client.list_token_auth_users request
1873
+ #
1874
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1875
+ # # over elements, and API calls will be issued to fetch pages as needed.
1876
+ # result.each do |item|
1877
+ # # Each element is of type ::Google::Cloud::Memorystore::V1::TokenAuthUser.
1878
+ # p item
1879
+ # end
1880
+ #
1881
+ def list_token_auth_users request, options = nil
1882
+ raise ::ArgumentError, "request must be provided" if request.nil?
1883
+
1884
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::ListTokenAuthUsersRequest
1885
+
1886
+ # Converts hash and nil to an options object
1887
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1888
+
1889
+ # Customize the options with defaults
1890
+ call_metadata = @config.rpcs.list_token_auth_users.metadata.to_h
1891
+
1892
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1893
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1894
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1895
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION,
1896
+ transports_version_send: [:rest]
1897
+
1898
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1899
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1900
+
1901
+ options.apply_defaults timeout: @config.rpcs.list_token_auth_users.timeout,
1902
+ metadata: call_metadata,
1903
+ retry_policy: @config.rpcs.list_token_auth_users.retry_policy
1904
+
1905
+ options.apply_defaults timeout: @config.timeout,
1906
+ metadata: @config.metadata,
1907
+ retry_policy: @config.retry_policy
1908
+
1909
+ @memorystore_stub.list_token_auth_users request, options do |result, operation|
1910
+ result = ::Gapic::Rest::PagedEnumerable.new @memorystore_stub, :list_token_auth_users, "token_auth_users", request, result, options
1911
+ yield result, operation if block_given?
1912
+ throw :response, result
1913
+ end
1914
+ rescue ::Gapic::Rest::Error => e
1915
+ raise ::Google::Cloud::Error.from_error(e)
1916
+ end
1917
+
1918
+ ##
1919
+ # Gets a specific token auth user for a token based auth enabled instance.
1920
+ #
1921
+ # @overload get_token_auth_user(request, options = nil)
1922
+ # Pass arguments to `get_token_auth_user` via a request object, either of type
1923
+ # {::Google::Cloud::Memorystore::V1::GetTokenAuthUserRequest} or an equivalent Hash.
1924
+ #
1925
+ # @param request [::Google::Cloud::Memorystore::V1::GetTokenAuthUserRequest, ::Hash]
1926
+ # A request object representing the call parameters. Required. To specify no
1927
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1928
+ # @param options [::Gapic::CallOptions, ::Hash]
1929
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1930
+ #
1931
+ # @overload get_token_auth_user(name: nil)
1932
+ # Pass arguments to `get_token_auth_user` via keyword arguments. Note that at
1933
+ # least one keyword argument is required. To specify no parameters, or to keep all
1934
+ # the default parameter values, pass an empty Hash as a request object (see above).
1935
+ #
1936
+ # @param name [::String]
1937
+ # Required. The name of token auth user for a basic auth enabled instance.
1938
+ # Format:
1939
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}/tokenAuthUsers/\\{token_auth_user}
1940
+ # @yield [result, operation] Access the result along with the TransportOperation object
1941
+ # @yieldparam result [::Google::Cloud::Memorystore::V1::TokenAuthUser]
1942
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1943
+ #
1944
+ # @return [::Google::Cloud::Memorystore::V1::TokenAuthUser]
1945
+ #
1946
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1947
+ #
1948
+ # @example Basic example
1949
+ # require "google/cloud/memorystore/v1"
1950
+ #
1951
+ # # Create a client object. The client can be reused for multiple calls.
1952
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Rest::Client.new
1953
+ #
1954
+ # # Create a request. To set request fields, pass in keyword arguments.
1955
+ # request = Google::Cloud::Memorystore::V1::GetTokenAuthUserRequest.new
1956
+ #
1957
+ # # Call the get_token_auth_user method.
1958
+ # result = client.get_token_auth_user request
1959
+ #
1960
+ # # The returned object is of type Google::Cloud::Memorystore::V1::TokenAuthUser.
1961
+ # p result
1962
+ #
1963
+ def get_token_auth_user request, options = nil
1964
+ raise ::ArgumentError, "request must be provided" if request.nil?
1965
+
1966
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::GetTokenAuthUserRequest
1967
+
1968
+ # Converts hash and nil to an options object
1969
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1970
+
1971
+ # Customize the options with defaults
1972
+ call_metadata = @config.rpcs.get_token_auth_user.metadata.to_h
1973
+
1974
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1975
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1976
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1977
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION,
1978
+ transports_version_send: [:rest]
1979
+
1980
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1981
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1982
+
1983
+ options.apply_defaults timeout: @config.rpcs.get_token_auth_user.timeout,
1984
+ metadata: call_metadata,
1985
+ retry_policy: @config.rpcs.get_token_auth_user.retry_policy
1986
+
1987
+ options.apply_defaults timeout: @config.timeout,
1988
+ metadata: @config.metadata,
1989
+ retry_policy: @config.retry_policy
1990
+
1991
+ @memorystore_stub.get_token_auth_user request, options do |result, operation|
1992
+ yield result, operation if block_given?
1993
+ end
1994
+ rescue ::Gapic::Rest::Error => e
1995
+ raise ::Google::Cloud::Error.from_error(e)
1996
+ end
1997
+
1998
+ ##
1999
+ # Lists all the auth tokens for a specific token auth user.
2000
+ #
2001
+ # @overload list_auth_tokens(request, options = nil)
2002
+ # Pass arguments to `list_auth_tokens` via a request object, either of type
2003
+ # {::Google::Cloud::Memorystore::V1::ListAuthTokensRequest} or an equivalent Hash.
2004
+ #
2005
+ # @param request [::Google::Cloud::Memorystore::V1::ListAuthTokensRequest, ::Hash]
2006
+ # A request object representing the call parameters. Required. To specify no
2007
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2008
+ # @param options [::Gapic::CallOptions, ::Hash]
2009
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2010
+ #
2011
+ # @overload list_auth_tokens(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
2012
+ # Pass arguments to `list_auth_tokens` via keyword arguments. Note that at
2013
+ # least one keyword argument is required. To specify no parameters, or to keep all
2014
+ # the default parameter values, pass an empty Hash as a request object (see above).
2015
+ #
2016
+ # @param parent [::String]
2017
+ # Required. The parent to list auth tokens from.
2018
+ # Format:
2019
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}/tokenAuthUsers/\\{token_auth_user}
2020
+ # @param page_size [::Integer]
2021
+ # Optional. The maximum number of items to return. The maximum value is 1000;
2022
+ # values above 1000 will be coerced to 1000.
2023
+ #
2024
+ # If not specified, a default value of 1000 will be used by the service.
2025
+ # Regardless of the page_size value, the response may include a partial list
2026
+ # and a caller should only rely on response's
2027
+ # `next_page_token`
2028
+ # to determine if there are more auth tokens left to be queried.
2029
+ # @param page_token [::String]
2030
+ # Optional. The `next_page_token` value returned from a previous
2031
+ # `ListAuthTokens` request, if any.
2032
+ # @param filter [::String]
2033
+ # Optional. Expression for filtering results.
2034
+ # @param order_by [::String]
2035
+ # Optional. Sort results by a defined order.
2036
+ # @yield [result, operation] Access the result along with the TransportOperation object
2037
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Memorystore::V1::AuthToken>]
2038
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2039
+ #
2040
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Memorystore::V1::AuthToken>]
2041
+ #
2042
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2043
+ #
2044
+ # @example Basic example
2045
+ # require "google/cloud/memorystore/v1"
2046
+ #
2047
+ # # Create a client object. The client can be reused for multiple calls.
2048
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Rest::Client.new
2049
+ #
2050
+ # # Create a request. To set request fields, pass in keyword arguments.
2051
+ # request = Google::Cloud::Memorystore::V1::ListAuthTokensRequest.new
2052
+ #
2053
+ # # Call the list_auth_tokens method.
2054
+ # result = client.list_auth_tokens request
2055
+ #
2056
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2057
+ # # over elements, and API calls will be issued to fetch pages as needed.
2058
+ # result.each do |item|
2059
+ # # Each element is of type ::Google::Cloud::Memorystore::V1::AuthToken.
2060
+ # p item
2061
+ # end
2062
+ #
2063
+ def list_auth_tokens request, options = nil
2064
+ raise ::ArgumentError, "request must be provided" if request.nil?
2065
+
2066
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::ListAuthTokensRequest
2067
+
2068
+ # Converts hash and nil to an options object
2069
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2070
+
2071
+ # Customize the options with defaults
2072
+ call_metadata = @config.rpcs.list_auth_tokens.metadata.to_h
2073
+
2074
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2075
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2076
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2077
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION,
2078
+ transports_version_send: [:rest]
2079
+
2080
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2081
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2082
+
2083
+ options.apply_defaults timeout: @config.rpcs.list_auth_tokens.timeout,
2084
+ metadata: call_metadata,
2085
+ retry_policy: @config.rpcs.list_auth_tokens.retry_policy
2086
+
2087
+ options.apply_defaults timeout: @config.timeout,
2088
+ metadata: @config.metadata,
2089
+ retry_policy: @config.retry_policy
2090
+
2091
+ @memorystore_stub.list_auth_tokens request, options do |result, operation|
2092
+ result = ::Gapic::Rest::PagedEnumerable.new @memorystore_stub, :list_auth_tokens, "auth_tokens", request, result, options
2093
+ yield result, operation if block_given?
2094
+ throw :response, result
2095
+ end
2096
+ rescue ::Gapic::Rest::Error => e
2097
+ raise ::Google::Cloud::Error.from_error(e)
2098
+ end
2099
+
2100
+ ##
2101
+ # Gets a token based auth enabled instance's auth token for a given user.
2102
+ #
2103
+ # @overload get_auth_token(request, options = nil)
2104
+ # Pass arguments to `get_auth_token` via a request object, either of type
2105
+ # {::Google::Cloud::Memorystore::V1::GetAuthTokenRequest} or an equivalent Hash.
2106
+ #
2107
+ # @param request [::Google::Cloud::Memorystore::V1::GetAuthTokenRequest, ::Hash]
2108
+ # A request object representing the call parameters. Required. To specify no
2109
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2110
+ # @param options [::Gapic::CallOptions, ::Hash]
2111
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2112
+ #
2113
+ # @overload get_auth_token(name: nil)
2114
+ # Pass arguments to `get_auth_token` via keyword arguments. Note that at
2115
+ # least one keyword argument is required. To specify no parameters, or to keep all
2116
+ # the default parameter values, pass an empty Hash as a request object (see above).
2117
+ #
2118
+ # @param name [::String]
2119
+ # Required. The name of token auth user for a token auth enabled instance.
2120
+ # Format:
2121
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}/tokenAuthUsers/\\{token_auth_user}/authTokens/\\{auth_token}
2122
+ # @yield [result, operation] Access the result along with the TransportOperation object
2123
+ # @yieldparam result [::Google::Cloud::Memorystore::V1::AuthToken]
2124
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2125
+ #
2126
+ # @return [::Google::Cloud::Memorystore::V1::AuthToken]
2127
+ #
2128
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2129
+ #
2130
+ # @example Basic example
2131
+ # require "google/cloud/memorystore/v1"
2132
+ #
2133
+ # # Create a client object. The client can be reused for multiple calls.
2134
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Rest::Client.new
2135
+ #
2136
+ # # Create a request. To set request fields, pass in keyword arguments.
2137
+ # request = Google::Cloud::Memorystore::V1::GetAuthTokenRequest.new
2138
+ #
2139
+ # # Call the get_auth_token method.
2140
+ # result = client.get_auth_token request
2141
+ #
2142
+ # # The returned object is of type Google::Cloud::Memorystore::V1::AuthToken.
2143
+ # p result
2144
+ #
2145
+ def get_auth_token request, options = nil
2146
+ raise ::ArgumentError, "request must be provided" if request.nil?
2147
+
2148
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::GetAuthTokenRequest
2149
+
2150
+ # Converts hash and nil to an options object
2151
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2152
+
2153
+ # Customize the options with defaults
2154
+ call_metadata = @config.rpcs.get_auth_token.metadata.to_h
2155
+
2156
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2157
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2158
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2159
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION,
2160
+ transports_version_send: [:rest]
2161
+
2162
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2163
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2164
+
2165
+ options.apply_defaults timeout: @config.rpcs.get_auth_token.timeout,
2166
+ metadata: call_metadata,
2167
+ retry_policy: @config.rpcs.get_auth_token.retry_policy
2168
+
2169
+ options.apply_defaults timeout: @config.timeout,
2170
+ metadata: @config.metadata,
2171
+ retry_policy: @config.retry_policy
2172
+
2173
+ @memorystore_stub.get_auth_token request, options do |result, operation|
2174
+ yield result, operation if block_given?
2175
+ end
2176
+ rescue ::Gapic::Rest::Error => e
2177
+ raise ::Google::Cloud::Error.from_error(e)
2178
+ end
2179
+
2180
+ ##
2181
+ # Adds a token auth user for a token based auth enabled instance.
2182
+ #
2183
+ # @overload add_token_auth_user(request, options = nil)
2184
+ # Pass arguments to `add_token_auth_user` via a request object, either of type
2185
+ # {::Google::Cloud::Memorystore::V1::AddTokenAuthUserRequest} or an equivalent Hash.
2186
+ #
2187
+ # @param request [::Google::Cloud::Memorystore::V1::AddTokenAuthUserRequest, ::Hash]
2188
+ # A request object representing the call parameters. Required. To specify no
2189
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2190
+ # @param options [::Gapic::CallOptions, ::Hash]
2191
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2192
+ #
2193
+ # @overload add_token_auth_user(instance: nil, token_auth_user: nil)
2194
+ # Pass arguments to `add_token_auth_user` via keyword arguments. Note that at
2195
+ # least one keyword argument is required. To specify no parameters, or to keep all
2196
+ # the default parameter values, pass an empty Hash as a request object (see above).
2197
+ #
2198
+ # @param instance [::String]
2199
+ # Required. The instance resource that this token auth user will be added
2200
+ # for. Format: projects/\\{project}/locations/\\{location}/instances/\\{instance}
2201
+ # @param token_auth_user [::String]
2202
+ # Required. The name of the token auth user to add.
2203
+ # @yield [result, operation] Access the result along with the TransportOperation object
2204
+ # @yieldparam result [::Gapic::Operation]
2205
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2206
+ #
2207
+ # @return [::Gapic::Operation]
2208
+ #
2209
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2210
+ #
2211
+ # @example Basic example
2212
+ # require "google/cloud/memorystore/v1"
2213
+ #
2214
+ # # Create a client object. The client can be reused for multiple calls.
2215
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Rest::Client.new
2216
+ #
2217
+ # # Create a request. To set request fields, pass in keyword arguments.
2218
+ # request = Google::Cloud::Memorystore::V1::AddTokenAuthUserRequest.new
2219
+ #
2220
+ # # Call the add_token_auth_user method.
2221
+ # result = client.add_token_auth_user request
2222
+ #
2223
+ # # The returned object is of type Gapic::Operation. You can use it to
2224
+ # # check the status of an operation, cancel it, or wait for results.
2225
+ # # Here is how to wait for a response.
2226
+ # result.wait_until_done! timeout: 60
2227
+ # if result.response?
2228
+ # p result.response
2229
+ # else
2230
+ # puts "No response received."
2231
+ # end
2232
+ #
2233
+ def add_token_auth_user request, options = nil
2234
+ raise ::ArgumentError, "request must be provided" if request.nil?
2235
+
2236
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::AddTokenAuthUserRequest
2237
+
2238
+ # Converts hash and nil to an options object
2239
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2240
+
2241
+ # Customize the options with defaults
2242
+ call_metadata = @config.rpcs.add_token_auth_user.metadata.to_h
2243
+
2244
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2245
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2246
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2247
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION,
2248
+ transports_version_send: [:rest]
2249
+
2250
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2251
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2252
+
2253
+ options.apply_defaults timeout: @config.rpcs.add_token_auth_user.timeout,
2254
+ metadata: call_metadata,
2255
+ retry_policy: @config.rpcs.add_token_auth_user.retry_policy
2256
+
2257
+ options.apply_defaults timeout: @config.timeout,
2258
+ metadata: @config.metadata,
2259
+ retry_policy: @config.retry_policy
2260
+
2261
+ @memorystore_stub.add_token_auth_user request, options do |result, operation|
2262
+ result = ::Gapic::Operation.new result, @operations_client, options: options
2263
+ yield result, operation if block_given?
2264
+ throw :response, result
2265
+ end
2266
+ rescue ::Gapic::Rest::Error => e
2267
+ raise ::Google::Cloud::Error.from_error(e)
2268
+ end
2269
+
2270
+ ##
2271
+ # Deletes a token auth user for a token based auth enabled instance.
2272
+ #
2273
+ # @overload delete_token_auth_user(request, options = nil)
2274
+ # Pass arguments to `delete_token_auth_user` via a request object, either of type
2275
+ # {::Google::Cloud::Memorystore::V1::DeleteTokenAuthUserRequest} or an equivalent Hash.
2276
+ #
2277
+ # @param request [::Google::Cloud::Memorystore::V1::DeleteTokenAuthUserRequest, ::Hash]
2278
+ # A request object representing the call parameters. Required. To specify no
2279
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2280
+ # @param options [::Gapic::CallOptions, ::Hash]
2281
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2282
+ #
2283
+ # @overload delete_token_auth_user(name: nil, request_id: nil, force: nil)
2284
+ # Pass arguments to `delete_token_auth_user` via keyword arguments. Note that at
2285
+ # least one keyword argument is required. To specify no parameters, or to keep all
2286
+ # the default parameter values, pass an empty Hash as a request object (see above).
2287
+ #
2288
+ # @param name [::String]
2289
+ # Required. The name of the token auth user to delete.
2290
+ # Format:
2291
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}/tokenAuthUsers/\\{token_auth_user}
2292
+ # @param request_id [::String]
2293
+ # Optional. An optional request ID to identify requests. Specify a unique
2294
+ # request ID so that if you must retry your request, the server will know to
2295
+ # ignore the request if it has already been completed. The server will
2296
+ # guarantee that for at least 60 minutes after the first request.
2297
+ #
2298
+ # For example, consider a situation where you make an initial request and the
2299
+ # request times out. If you make the request again with the same request
2300
+ # ID, the server can check if original operation with the same request ID
2301
+ # was received, and if so, will ignore the second request. This prevents
2302
+ # clients from accidentally creating duplicate commitments.
2303
+ #
2304
+ # The request ID must be a valid UUID with the exception that zero UUID is
2305
+ # not supported (00000000-0000-0000-0000-000000000000).
2306
+ # @param force [::Boolean]
2307
+ # Optional. If set to true, any auth tokens from this user will also be
2308
+ # deleted. Otherwise, the request will only work if the user has no auth
2309
+ # tokens.
2310
+ # @yield [result, operation] Access the result along with the TransportOperation object
2311
+ # @yieldparam result [::Gapic::Operation]
2312
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2313
+ #
2314
+ # @return [::Gapic::Operation]
2315
+ #
2316
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2317
+ #
2318
+ # @example Basic example
2319
+ # require "google/cloud/memorystore/v1"
2320
+ #
2321
+ # # Create a client object. The client can be reused for multiple calls.
2322
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Rest::Client.new
2323
+ #
2324
+ # # Create a request. To set request fields, pass in keyword arguments.
2325
+ # request = Google::Cloud::Memorystore::V1::DeleteTokenAuthUserRequest.new
2326
+ #
2327
+ # # Call the delete_token_auth_user method.
2328
+ # result = client.delete_token_auth_user request
2329
+ #
2330
+ # # The returned object is of type Gapic::Operation. You can use it to
2331
+ # # check the status of an operation, cancel it, or wait for results.
2332
+ # # Here is how to wait for a response.
2333
+ # result.wait_until_done! timeout: 60
2334
+ # if result.response?
2335
+ # p result.response
2336
+ # else
2337
+ # puts "No response received."
2338
+ # end
2339
+ #
2340
+ def delete_token_auth_user request, options = nil
2341
+ raise ::ArgumentError, "request must be provided" if request.nil?
2342
+
2343
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::DeleteTokenAuthUserRequest
2344
+
2345
+ # Converts hash and nil to an options object
2346
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2347
+
2348
+ # Customize the options with defaults
2349
+ call_metadata = @config.rpcs.delete_token_auth_user.metadata.to_h
2350
+
2351
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2352
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2353
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2354
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION,
2355
+ transports_version_send: [:rest]
2356
+
2357
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2358
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2359
+
2360
+ options.apply_defaults timeout: @config.rpcs.delete_token_auth_user.timeout,
2361
+ metadata: call_metadata,
2362
+ retry_policy: @config.rpcs.delete_token_auth_user.retry_policy
2363
+
2364
+ options.apply_defaults timeout: @config.timeout,
2365
+ metadata: @config.metadata,
2366
+ retry_policy: @config.retry_policy
2367
+
2368
+ @memorystore_stub.delete_token_auth_user request, options do |result, operation|
2369
+ result = ::Gapic::Operation.new result, @operations_client, options: options
2370
+ yield result, operation if block_given?
2371
+ throw :response, result
2372
+ end
2373
+ rescue ::Gapic::Rest::Error => e
2374
+ raise ::Google::Cloud::Error.from_error(e)
2375
+ end
2376
+
2377
+ ##
2378
+ # Adds a token for a user of a token based auth enabled instance.
2379
+ #
2380
+ # @overload add_auth_token(request, options = nil)
2381
+ # Pass arguments to `add_auth_token` via a request object, either of type
2382
+ # {::Google::Cloud::Memorystore::V1::AddAuthTokenRequest} or an equivalent Hash.
2383
+ #
2384
+ # @param request [::Google::Cloud::Memorystore::V1::AddAuthTokenRequest, ::Hash]
2385
+ # A request object representing the call parameters. Required. To specify no
2386
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2387
+ # @param options [::Gapic::CallOptions, ::Hash]
2388
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2389
+ #
2390
+ # @overload add_auth_token(token_auth_user: nil, auth_token: nil)
2391
+ # Pass arguments to `add_auth_token` via keyword arguments. Note that at
2392
+ # least one keyword argument is required. To specify no parameters, or to keep all
2393
+ # the default parameter values, pass an empty Hash as a request object (see above).
2394
+ #
2395
+ # @param token_auth_user [::String]
2396
+ # Required. The name of the token auth user resource that this token will be
2397
+ # added for.
2398
+ # @param auth_token [::Google::Cloud::Memorystore::V1::AuthToken, ::Hash]
2399
+ # Required. The auth token to add.
2400
+ # @yield [result, operation] Access the result along with the TransportOperation object
2401
+ # @yieldparam result [::Gapic::Operation]
2402
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2403
+ #
2404
+ # @return [::Gapic::Operation]
2405
+ #
2406
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2407
+ #
2408
+ # @example Basic example
2409
+ # require "google/cloud/memorystore/v1"
2410
+ #
2411
+ # # Create a client object. The client can be reused for multiple calls.
2412
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Rest::Client.new
2413
+ #
2414
+ # # Create a request. To set request fields, pass in keyword arguments.
2415
+ # request = Google::Cloud::Memorystore::V1::AddAuthTokenRequest.new
2416
+ #
2417
+ # # Call the add_auth_token method.
2418
+ # result = client.add_auth_token request
2419
+ #
2420
+ # # The returned object is of type Gapic::Operation. You can use it to
2421
+ # # check the status of an operation, cancel it, or wait for results.
2422
+ # # Here is how to wait for a response.
2423
+ # result.wait_until_done! timeout: 60
2424
+ # if result.response?
2425
+ # p result.response
2426
+ # else
2427
+ # puts "No response received."
2428
+ # end
2429
+ #
2430
+ def add_auth_token request, options = nil
2431
+ raise ::ArgumentError, "request must be provided" if request.nil?
2432
+
2433
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::AddAuthTokenRequest
2434
+
2435
+ # Converts hash and nil to an options object
2436
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2437
+
2438
+ # Customize the options with defaults
2439
+ call_metadata = @config.rpcs.add_auth_token.metadata.to_h
2440
+
2441
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2442
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2443
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2444
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION,
2445
+ transports_version_send: [:rest]
2446
+
2447
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2448
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2449
+
2450
+ options.apply_defaults timeout: @config.rpcs.add_auth_token.timeout,
2451
+ metadata: call_metadata,
2452
+ retry_policy: @config.rpcs.add_auth_token.retry_policy
2453
+
2454
+ options.apply_defaults timeout: @config.timeout,
2455
+ metadata: @config.metadata,
2456
+ retry_policy: @config.retry_policy
2457
+
2458
+ @memorystore_stub.add_auth_token request, options do |result, operation|
2459
+ result = ::Gapic::Operation.new result, @operations_client, options: options
2460
+ yield result, operation if block_given?
2461
+ throw :response, result
2462
+ end
2463
+ rescue ::Gapic::Rest::Error => e
2464
+ raise ::Google::Cloud::Error.from_error(e)
2465
+ end
2466
+
2467
+ ##
2468
+ # Deletes a token for a user of a token based auth enabled instance.
2469
+ #
2470
+ # @overload delete_auth_token(request, options = nil)
2471
+ # Pass arguments to `delete_auth_token` via a request object, either of type
2472
+ # {::Google::Cloud::Memorystore::V1::DeleteAuthTokenRequest} or an equivalent Hash.
2473
+ #
2474
+ # @param request [::Google::Cloud::Memorystore::V1::DeleteAuthTokenRequest, ::Hash]
2475
+ # A request object representing the call parameters. Required. To specify no
2476
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2477
+ # @param options [::Gapic::CallOptions, ::Hash]
2478
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2479
+ #
2480
+ # @overload delete_auth_token(name: nil)
2481
+ # Pass arguments to `delete_auth_token` via keyword arguments. Note that at
2482
+ # least one keyword argument is required. To specify no parameters, or to keep all
2483
+ # the default parameter values, pass an empty Hash as a request object (see above).
2484
+ #
2485
+ # @param name [::String]
2486
+ # Required. The name of the token auth user resource that this token will be
2487
+ # deleted from. Format:
2488
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}/tokenAuthUsers/\\{token_auth_user}/authTokens/\\{name}
2489
+ # @yield [result, operation] Access the result along with the TransportOperation object
2490
+ # @yieldparam result [::Gapic::Operation]
2491
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2492
+ #
2493
+ # @return [::Gapic::Operation]
2494
+ #
2495
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2496
+ #
2497
+ # @example Basic example
2498
+ # require "google/cloud/memorystore/v1"
2499
+ #
2500
+ # # Create a client object. The client can be reused for multiple calls.
2501
+ # client = Google::Cloud::Memorystore::V1::Memorystore::Rest::Client.new
2502
+ #
2503
+ # # Create a request. To set request fields, pass in keyword arguments.
2504
+ # request = Google::Cloud::Memorystore::V1::DeleteAuthTokenRequest.new
2505
+ #
2506
+ # # Call the delete_auth_token method.
2507
+ # result = client.delete_auth_token request
2508
+ #
2509
+ # # The returned object is of type Gapic::Operation. You can use it to
2510
+ # # check the status of an operation, cancel it, or wait for results.
2511
+ # # Here is how to wait for a response.
2512
+ # result.wait_until_done! timeout: 60
2513
+ # if result.response?
2514
+ # p result.response
2515
+ # else
2516
+ # puts "No response received."
2517
+ # end
2518
+ #
2519
+ def delete_auth_token request, options = nil
2520
+ raise ::ArgumentError, "request must be provided" if request.nil?
2521
+
2522
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1::DeleteAuthTokenRequest
2523
+
2524
+ # Converts hash and nil to an options object
2525
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2526
+
2527
+ # Customize the options with defaults
2528
+ call_metadata = @config.rpcs.delete_auth_token.metadata.to_h
2529
+
2530
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2531
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2532
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2533
+ gapic_version: ::Google::Cloud::Memorystore::V1::VERSION,
2534
+ transports_version_send: [:rest]
2535
+
2536
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2537
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2538
+
2539
+ options.apply_defaults timeout: @config.rpcs.delete_auth_token.timeout,
2540
+ metadata: call_metadata,
2541
+ retry_policy: @config.rpcs.delete_auth_token.retry_policy
2542
+
2543
+ options.apply_defaults timeout: @config.timeout,
2544
+ metadata: @config.metadata,
2545
+ retry_policy: @config.retry_policy
2546
+
2547
+ @memorystore_stub.delete_auth_token request, options do |result, operation|
2548
+ result = ::Gapic::Operation.new result, @operations_client, options: options
2549
+ yield result, operation if block_given?
2550
+ throw :response, result
2551
+ end
2552
+ rescue ::Gapic::Rest::Error => e
2553
+ raise ::Google::Cloud::Error.from_error(e)
2554
+ end
2555
+
1819
2556
  ##
1820
2557
  # Configuration class for the Memorystore REST API.
1821
2558
  #
@@ -2056,6 +2793,46 @@ module Google
2056
2793
  # @return [::Gapic::Config::Method]
2057
2794
  #
2058
2795
  attr_reader :finish_migration
2796
+ ##
2797
+ # RPC-specific configuration for `list_token_auth_users`
2798
+ # @return [::Gapic::Config::Method]
2799
+ #
2800
+ attr_reader :list_token_auth_users
2801
+ ##
2802
+ # RPC-specific configuration for `get_token_auth_user`
2803
+ # @return [::Gapic::Config::Method]
2804
+ #
2805
+ attr_reader :get_token_auth_user
2806
+ ##
2807
+ # RPC-specific configuration for `list_auth_tokens`
2808
+ # @return [::Gapic::Config::Method]
2809
+ #
2810
+ attr_reader :list_auth_tokens
2811
+ ##
2812
+ # RPC-specific configuration for `get_auth_token`
2813
+ # @return [::Gapic::Config::Method]
2814
+ #
2815
+ attr_reader :get_auth_token
2816
+ ##
2817
+ # RPC-specific configuration for `add_token_auth_user`
2818
+ # @return [::Gapic::Config::Method]
2819
+ #
2820
+ attr_reader :add_token_auth_user
2821
+ ##
2822
+ # RPC-specific configuration for `delete_token_auth_user`
2823
+ # @return [::Gapic::Config::Method]
2824
+ #
2825
+ attr_reader :delete_token_auth_user
2826
+ ##
2827
+ # RPC-specific configuration for `add_auth_token`
2828
+ # @return [::Gapic::Config::Method]
2829
+ #
2830
+ attr_reader :add_auth_token
2831
+ ##
2832
+ # RPC-specific configuration for `delete_auth_token`
2833
+ # @return [::Gapic::Config::Method]
2834
+ #
2835
+ attr_reader :delete_auth_token
2059
2836
 
2060
2837
  # @private
2061
2838
  def initialize parent_rpcs = nil
@@ -2093,6 +2870,22 @@ module Google
2093
2870
  @start_migration = ::Gapic::Config::Method.new start_migration_config
2094
2871
  finish_migration_config = parent_rpcs.finish_migration if parent_rpcs.respond_to? :finish_migration
2095
2872
  @finish_migration = ::Gapic::Config::Method.new finish_migration_config
2873
+ list_token_auth_users_config = parent_rpcs.list_token_auth_users if parent_rpcs.respond_to? :list_token_auth_users
2874
+ @list_token_auth_users = ::Gapic::Config::Method.new list_token_auth_users_config
2875
+ get_token_auth_user_config = parent_rpcs.get_token_auth_user if parent_rpcs.respond_to? :get_token_auth_user
2876
+ @get_token_auth_user = ::Gapic::Config::Method.new get_token_auth_user_config
2877
+ list_auth_tokens_config = parent_rpcs.list_auth_tokens if parent_rpcs.respond_to? :list_auth_tokens
2878
+ @list_auth_tokens = ::Gapic::Config::Method.new list_auth_tokens_config
2879
+ get_auth_token_config = parent_rpcs.get_auth_token if parent_rpcs.respond_to? :get_auth_token
2880
+ @get_auth_token = ::Gapic::Config::Method.new get_auth_token_config
2881
+ add_token_auth_user_config = parent_rpcs.add_token_auth_user if parent_rpcs.respond_to? :add_token_auth_user
2882
+ @add_token_auth_user = ::Gapic::Config::Method.new add_token_auth_user_config
2883
+ delete_token_auth_user_config = parent_rpcs.delete_token_auth_user if parent_rpcs.respond_to? :delete_token_auth_user
2884
+ @delete_token_auth_user = ::Gapic::Config::Method.new delete_token_auth_user_config
2885
+ add_auth_token_config = parent_rpcs.add_auth_token if parent_rpcs.respond_to? :add_auth_token
2886
+ @add_auth_token = ::Gapic::Config::Method.new add_auth_token_config
2887
+ delete_auth_token_config = parent_rpcs.delete_auth_token if parent_rpcs.respond_to? :delete_auth_token
2888
+ @delete_auth_token = ::Gapic::Config::Method.new delete_auth_token_config
2096
2889
 
2097
2890
  yield self if block_given?
2098
2891
  end