google-cloud-recommender-v1 0.5.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +188 -190
- data/README.md +66 -2
- data/lib/google/cloud/recommender/v1.rb +3 -0
- data/lib/google/cloud/recommender/v1/recommender/client.rb +48 -20
- data/lib/google/cloud/recommender/v1/recommender/paths.rb +268 -40
- data/lib/google/cloud/recommender/v1/recommender_service_services_pb.rb +8 -8
- data/lib/google/cloud/recommender/v1/version.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +6 -0
- data/proto_docs/google/api/resource.rb +50 -14
- data/proto_docs/google/cloud/recommender/v1/recommendation.rb +3 -3
- data/proto_docs/google/cloud/recommender/v1/recommender_service.rb +4 -0
- data/proto_docs/google/protobuf/timestamp.rb +10 -1
- metadata +9 -7
@@ -63,25 +63,43 @@ module Google
|
|
63
63
|
parent_config = while namespace.any?
|
64
64
|
parent_name = namespace.join "::"
|
65
65
|
parent_const = const_get parent_name
|
66
|
-
break parent_const.configure if parent_const
|
66
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
67
67
|
namespace.pop
|
68
68
|
end
|
69
69
|
default_config = Client::Configuration.new parent_config
|
70
70
|
|
71
|
+
default_config.rpcs.list_insights.timeout = 60.0
|
72
|
+
default_config.rpcs.list_insights.retry_policy = {
|
73
|
+
initial_delay: 0.1,
|
74
|
+
max_delay: 60.0,
|
75
|
+
multiplier: 1.3,
|
76
|
+
retry_codes: [4, 14]
|
77
|
+
}
|
78
|
+
|
79
|
+
default_config.rpcs.get_insight.timeout = 60.0
|
80
|
+
default_config.rpcs.get_insight.retry_policy = {
|
81
|
+
initial_delay: 0.1,
|
82
|
+
max_delay: 60.0,
|
83
|
+
multiplier: 1.3,
|
84
|
+
retry_codes: [4, 14]
|
85
|
+
}
|
86
|
+
|
87
|
+
default_config.rpcs.mark_insight_accepted.timeout = 60.0
|
88
|
+
|
71
89
|
default_config.rpcs.list_recommendations.timeout = 60.0
|
72
90
|
default_config.rpcs.list_recommendations.retry_policy = {
|
73
91
|
initial_delay: 0.1,
|
74
|
-
|
75
|
-
|
76
|
-
|
92
|
+
max_delay: 60.0,
|
93
|
+
multiplier: 1.3,
|
94
|
+
retry_codes: [4, 14]
|
77
95
|
}
|
78
96
|
|
79
97
|
default_config.rpcs.get_recommendation.timeout = 60.0
|
80
98
|
default_config.rpcs.get_recommendation.retry_policy = {
|
81
99
|
initial_delay: 0.1,
|
82
|
-
|
83
|
-
|
84
|
-
|
100
|
+
max_delay: 60.0,
|
101
|
+
multiplier: 1.3,
|
102
|
+
retry_codes: [4, 14]
|
85
103
|
}
|
86
104
|
|
87
105
|
default_config.rpcs.mark_recommendation_claimed.timeout = 60.0
|
@@ -151,7 +169,13 @@ module Google
|
|
151
169
|
|
152
170
|
# Create credentials
|
153
171
|
credentials = @config.credentials
|
154
|
-
|
172
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
173
|
+
# but only if the default endpoint does not have a region prefix.
|
174
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
175
|
+
@config.endpoint == Client.configure.endpoint &&
|
176
|
+
!@config.endpoint.split(".").first.include?("-")
|
177
|
+
credentials ||= Credentials.default scope: @config.scope,
|
178
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
155
179
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
156
180
|
credentials = Credentials.new credentials, scope: @config.scope
|
157
181
|
end
|
@@ -197,6 +221,8 @@ module Google
|
|
197
221
|
#
|
198
222
|
# LOCATION here refers to GCP Locations:
|
199
223
|
# https://cloud.google.com/about/locations/
|
224
|
+
# INSIGHT_TYPE_ID refers to supported insight types:
|
225
|
+
# https://cloud.google.com/recommender/docs/insights/insight-types.)
|
200
226
|
# @param page_size [::Integer]
|
201
227
|
# Optional. The maximum number of results to return from this request. Non-positive
|
202
228
|
# values are ignored. If not specified, the server will determine the number
|
@@ -428,6 +454,8 @@ module Google
|
|
428
454
|
#
|
429
455
|
# LOCATION here refers to GCP Locations:
|
430
456
|
# https://cloud.google.com/about/locations/
|
457
|
+
# RECOMMENDER_ID refers to supported recommenders:
|
458
|
+
# https://cloud.google.com/recommender/docs/recommenders.
|
431
459
|
# @param page_size [::Integer]
|
432
460
|
# Optional. The maximum number of results to return from this request. Non-positive
|
433
461
|
# values are ignored. If not specified, the server will determine the number
|
@@ -888,14 +916,14 @@ module Google
|
|
888
916
|
|
889
917
|
config_attr :endpoint, "recommender.googleapis.com", ::String
|
890
918
|
config_attr :credentials, nil do |value|
|
891
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
919
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
892
920
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
893
921
|
allowed.any? { |klass| klass === value }
|
894
922
|
end
|
895
923
|
config_attr :scope, nil, ::String, ::Array, nil
|
896
924
|
config_attr :lib_name, nil, ::String, nil
|
897
925
|
config_attr :lib_version, nil, ::String, nil
|
898
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
926
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
899
927
|
config_attr :interceptors, nil, ::Array, nil
|
900
928
|
config_attr :timeout, nil, ::Numeric, nil
|
901
929
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -916,7 +944,7 @@ module Google
|
|
916
944
|
def rpcs
|
917
945
|
@rpcs ||= begin
|
918
946
|
parent_rpcs = nil
|
919
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
947
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
920
948
|
Rpcs.new parent_rpcs
|
921
949
|
end
|
922
950
|
end
|
@@ -928,7 +956,7 @@ module Google
|
|
928
956
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
929
957
|
# the following configuration fields:
|
930
958
|
#
|
931
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
959
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
932
960
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
933
961
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
934
962
|
# include the following keys:
|
@@ -982,21 +1010,21 @@ module Google
|
|
982
1010
|
|
983
1011
|
# @private
|
984
1012
|
def initialize parent_rpcs = nil
|
985
|
-
list_insights_config = parent_rpcs
|
1013
|
+
list_insights_config = parent_rpcs.list_insights if parent_rpcs.respond_to? :list_insights
|
986
1014
|
@list_insights = ::Gapic::Config::Method.new list_insights_config
|
987
|
-
get_insight_config = parent_rpcs
|
1015
|
+
get_insight_config = parent_rpcs.get_insight if parent_rpcs.respond_to? :get_insight
|
988
1016
|
@get_insight = ::Gapic::Config::Method.new get_insight_config
|
989
|
-
mark_insight_accepted_config = parent_rpcs
|
1017
|
+
mark_insight_accepted_config = parent_rpcs.mark_insight_accepted if parent_rpcs.respond_to? :mark_insight_accepted
|
990
1018
|
@mark_insight_accepted = ::Gapic::Config::Method.new mark_insight_accepted_config
|
991
|
-
list_recommendations_config = parent_rpcs
|
1019
|
+
list_recommendations_config = parent_rpcs.list_recommendations if parent_rpcs.respond_to? :list_recommendations
|
992
1020
|
@list_recommendations = ::Gapic::Config::Method.new list_recommendations_config
|
993
|
-
get_recommendation_config = parent_rpcs
|
1021
|
+
get_recommendation_config = parent_rpcs.get_recommendation if parent_rpcs.respond_to? :get_recommendation
|
994
1022
|
@get_recommendation = ::Gapic::Config::Method.new get_recommendation_config
|
995
|
-
mark_recommendation_claimed_config = parent_rpcs
|
1023
|
+
mark_recommendation_claimed_config = parent_rpcs.mark_recommendation_claimed if parent_rpcs.respond_to? :mark_recommendation_claimed
|
996
1024
|
@mark_recommendation_claimed = ::Gapic::Config::Method.new mark_recommendation_claimed_config
|
997
|
-
mark_recommendation_succeeded_config = parent_rpcs
|
1025
|
+
mark_recommendation_succeeded_config = parent_rpcs.mark_recommendation_succeeded if parent_rpcs.respond_to? :mark_recommendation_succeeded
|
998
1026
|
@mark_recommendation_succeeded = ::Gapic::Config::Method.new mark_recommendation_succeeded_config
|
999
|
-
mark_recommendation_failed_config = parent_rpcs
|
1027
|
+
mark_recommendation_failed_config = parent_rpcs.mark_recommendation_failed if parent_rpcs.respond_to? :mark_recommendation_failed
|
1000
1028
|
@mark_recommendation_failed = ::Gapic::Config::Method.new mark_recommendation_failed_config
|
1001
1029
|
|
1002
1030
|
yield self if block_given?
|
@@ -27,81 +27,309 @@ module Google
|
|
27
27
|
##
|
28
28
|
# Create a fully-qualified Insight resource string.
|
29
29
|
#
|
30
|
-
#
|
30
|
+
# @overload insight_path(project:, location:, insight_type:, insight:)
|
31
|
+
# The resource will be in the following format:
|
31
32
|
#
|
32
|
-
#
|
33
|
+
# `projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight}`
|
33
34
|
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
35
|
+
# @param project [String]
|
36
|
+
# @param location [String]
|
37
|
+
# @param insight_type [String]
|
38
|
+
# @param insight [String]
|
39
|
+
#
|
40
|
+
# @overload insight_path(billing_account:, location:, insight_type:, insight:)
|
41
|
+
# The resource will be in the following format:
|
42
|
+
#
|
43
|
+
# `billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/insights/{insight}`
|
44
|
+
#
|
45
|
+
# @param billing_account [String]
|
46
|
+
# @param location [String]
|
47
|
+
# @param insight_type [String]
|
48
|
+
# @param insight [String]
|
49
|
+
#
|
50
|
+
# @overload insight_path(folder:, location:, insight_type:, insight:)
|
51
|
+
# The resource will be in the following format:
|
52
|
+
#
|
53
|
+
# `folders/{folder}/locations/{location}/insightTypes/{insight_type}/insights/{insight}`
|
54
|
+
#
|
55
|
+
# @param folder [String]
|
56
|
+
# @param location [String]
|
57
|
+
# @param insight_type [String]
|
58
|
+
# @param insight [String]
|
59
|
+
#
|
60
|
+
# @overload insight_path(organization:, location:, insight_type:, insight:)
|
61
|
+
# The resource will be in the following format:
|
62
|
+
#
|
63
|
+
# `organizations/{organization}/locations/{location}/insightTypes/{insight_type}/insights/{insight}`
|
64
|
+
#
|
65
|
+
# @param organization [String]
|
66
|
+
# @param location [String]
|
67
|
+
# @param insight_type [String]
|
68
|
+
# @param insight [String]
|
38
69
|
#
|
39
70
|
# @return [::String]
|
40
|
-
def insight_path
|
41
|
-
|
42
|
-
|
43
|
-
|
71
|
+
def insight_path **args
|
72
|
+
resources = {
|
73
|
+
"insight:insight_type:location:project" => (proc do |project:, location:, insight_type:, insight:|
|
74
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
75
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
76
|
+
raise ::ArgumentError, "insight_type cannot contain /" if insight_type.to_s.include? "/"
|
77
|
+
|
78
|
+
"projects/#{project}/locations/#{location}/insightTypes/#{insight_type}/insights/#{insight}"
|
79
|
+
end),
|
80
|
+
"billing_account:insight:insight_type:location" => (proc do |billing_account:, location:, insight_type:, insight:|
|
81
|
+
raise ::ArgumentError, "billing_account cannot contain /" if billing_account.to_s.include? "/"
|
82
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
83
|
+
raise ::ArgumentError, "insight_type cannot contain /" if insight_type.to_s.include? "/"
|
84
|
+
|
85
|
+
"billingAccounts/#{billing_account}/locations/#{location}/insightTypes/#{insight_type}/insights/#{insight}"
|
86
|
+
end),
|
87
|
+
"folder:insight:insight_type:location" => (proc do |folder:, location:, insight_type:, insight:|
|
88
|
+
raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
|
89
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
90
|
+
raise ::ArgumentError, "insight_type cannot contain /" if insight_type.to_s.include? "/"
|
91
|
+
|
92
|
+
"folders/#{folder}/locations/#{location}/insightTypes/#{insight_type}/insights/#{insight}"
|
93
|
+
end),
|
94
|
+
"insight:insight_type:location:organization" => (proc do |organization:, location:, insight_type:, insight:|
|
95
|
+
raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
|
96
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
97
|
+
raise ::ArgumentError, "insight_type cannot contain /" if insight_type.to_s.include? "/"
|
98
|
+
|
99
|
+
"organizations/#{organization}/locations/#{location}/insightTypes/#{insight_type}/insights/#{insight}"
|
100
|
+
end)
|
101
|
+
}
|
44
102
|
|
45
|
-
"
|
103
|
+
resource = resources[args.keys.sort.join(":")]
|
104
|
+
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
|
105
|
+
resource.call(**args)
|
46
106
|
end
|
47
107
|
|
48
108
|
##
|
49
109
|
# Create a fully-qualified InsightType resource string.
|
50
110
|
#
|
51
|
-
#
|
111
|
+
# @overload insight_type_path(project:, location:, insight_type:)
|
112
|
+
# The resource will be in the following format:
|
52
113
|
#
|
53
|
-
#
|
114
|
+
# `projects/{project}/locations/{location}/insightTypes/{insight_type}`
|
54
115
|
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
116
|
+
# @param project [String]
|
117
|
+
# @param location [String]
|
118
|
+
# @param insight_type [String]
|
119
|
+
#
|
120
|
+
# @overload insight_type_path(billing_account:, location:, insight_type:)
|
121
|
+
# The resource will be in the following format:
|
122
|
+
#
|
123
|
+
# `billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}`
|
124
|
+
#
|
125
|
+
# @param billing_account [String]
|
126
|
+
# @param location [String]
|
127
|
+
# @param insight_type [String]
|
128
|
+
#
|
129
|
+
# @overload insight_type_path(folder:, location:, insight_type:)
|
130
|
+
# The resource will be in the following format:
|
131
|
+
#
|
132
|
+
# `folders/{folder}/locations/{location}/insightTypes/{insight_type}`
|
133
|
+
#
|
134
|
+
# @param folder [String]
|
135
|
+
# @param location [String]
|
136
|
+
# @param insight_type [String]
|
137
|
+
#
|
138
|
+
# @overload insight_type_path(organization:, location:, insight_type:)
|
139
|
+
# The resource will be in the following format:
|
140
|
+
#
|
141
|
+
# `organizations/{organization}/locations/{location}/insightTypes/{insight_type}`
|
142
|
+
#
|
143
|
+
# @param organization [String]
|
144
|
+
# @param location [String]
|
145
|
+
# @param insight_type [String]
|
58
146
|
#
|
59
147
|
# @return [::String]
|
60
|
-
def insight_type_path
|
61
|
-
|
62
|
-
|
148
|
+
def insight_type_path **args
|
149
|
+
resources = {
|
150
|
+
"insight_type:location:project" => (proc do |project:, location:, insight_type:|
|
151
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
152
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
153
|
+
|
154
|
+
"projects/#{project}/locations/#{location}/insightTypes/#{insight_type}"
|
155
|
+
end),
|
156
|
+
"billing_account:insight_type:location" => (proc do |billing_account:, location:, insight_type:|
|
157
|
+
raise ::ArgumentError, "billing_account cannot contain /" if billing_account.to_s.include? "/"
|
158
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
159
|
+
|
160
|
+
"billingAccounts/#{billing_account}/locations/#{location}/insightTypes/#{insight_type}"
|
161
|
+
end),
|
162
|
+
"folder:insight_type:location" => (proc do |folder:, location:, insight_type:|
|
163
|
+
raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
|
164
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
165
|
+
|
166
|
+
"folders/#{folder}/locations/#{location}/insightTypes/#{insight_type}"
|
167
|
+
end),
|
168
|
+
"insight_type:location:organization" => (proc do |organization:, location:, insight_type:|
|
169
|
+
raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
|
170
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
171
|
+
|
172
|
+
"organizations/#{organization}/locations/#{location}/insightTypes/#{insight_type}"
|
173
|
+
end)
|
174
|
+
}
|
63
175
|
|
64
|
-
"
|
176
|
+
resource = resources[args.keys.sort.join(":")]
|
177
|
+
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
|
178
|
+
resource.call(**args)
|
65
179
|
end
|
66
180
|
|
67
181
|
##
|
68
182
|
# Create a fully-qualified Recommendation resource string.
|
69
183
|
#
|
70
|
-
#
|
184
|
+
# @overload recommendation_path(project:, location:, recommender:, recommendation:)
|
185
|
+
# The resource will be in the following format:
|
71
186
|
#
|
72
|
-
#
|
187
|
+
# `projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}`
|
73
188
|
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
189
|
+
# @param project [String]
|
190
|
+
# @param location [String]
|
191
|
+
# @param recommender [String]
|
192
|
+
# @param recommendation [String]
|
193
|
+
#
|
194
|
+
# @overload recommendation_path(billing_account:, location:, recommender:, recommendation:)
|
195
|
+
# The resource will be in the following format:
|
196
|
+
#
|
197
|
+
# `billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}`
|
198
|
+
#
|
199
|
+
# @param billing_account [String]
|
200
|
+
# @param location [String]
|
201
|
+
# @param recommender [String]
|
202
|
+
# @param recommendation [String]
|
203
|
+
#
|
204
|
+
# @overload recommendation_path(folder:, location:, recommender:, recommendation:)
|
205
|
+
# The resource will be in the following format:
|
206
|
+
#
|
207
|
+
# `folders/{folder}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}`
|
208
|
+
#
|
209
|
+
# @param folder [String]
|
210
|
+
# @param location [String]
|
211
|
+
# @param recommender [String]
|
212
|
+
# @param recommendation [String]
|
213
|
+
#
|
214
|
+
# @overload recommendation_path(organization:, location:, recommender:, recommendation:)
|
215
|
+
# The resource will be in the following format:
|
216
|
+
#
|
217
|
+
# `organizations/{organization}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}`
|
218
|
+
#
|
219
|
+
# @param organization [String]
|
220
|
+
# @param location [String]
|
221
|
+
# @param recommender [String]
|
222
|
+
# @param recommendation [String]
|
78
223
|
#
|
79
224
|
# @return [::String]
|
80
|
-
def recommendation_path
|
81
|
-
|
82
|
-
|
83
|
-
|
225
|
+
def recommendation_path **args
|
226
|
+
resources = {
|
227
|
+
"location:project:recommendation:recommender" => (proc do |project:, location:, recommender:, recommendation:|
|
228
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
229
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
230
|
+
raise ::ArgumentError, "recommender cannot contain /" if recommender.to_s.include? "/"
|
231
|
+
|
232
|
+
"projects/#{project}/locations/#{location}/recommenders/#{recommender}/recommendations/#{recommendation}"
|
233
|
+
end),
|
234
|
+
"billing_account:location:recommendation:recommender" => (proc do |billing_account:, location:, recommender:, recommendation:|
|
235
|
+
raise ::ArgumentError, "billing_account cannot contain /" if billing_account.to_s.include? "/"
|
236
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
237
|
+
raise ::ArgumentError, "recommender cannot contain /" if recommender.to_s.include? "/"
|
238
|
+
|
239
|
+
"billingAccounts/#{billing_account}/locations/#{location}/recommenders/#{recommender}/recommendations/#{recommendation}"
|
240
|
+
end),
|
241
|
+
"folder:location:recommendation:recommender" => (proc do |folder:, location:, recommender:, recommendation:|
|
242
|
+
raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
|
243
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
244
|
+
raise ::ArgumentError, "recommender cannot contain /" if recommender.to_s.include? "/"
|
245
|
+
|
246
|
+
"folders/#{folder}/locations/#{location}/recommenders/#{recommender}/recommendations/#{recommendation}"
|
247
|
+
end),
|
248
|
+
"location:organization:recommendation:recommender" => (proc do |organization:, location:, recommender:, recommendation:|
|
249
|
+
raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
|
250
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
251
|
+
raise ::ArgumentError, "recommender cannot contain /" if recommender.to_s.include? "/"
|
252
|
+
|
253
|
+
"organizations/#{organization}/locations/#{location}/recommenders/#{recommender}/recommendations/#{recommendation}"
|
254
|
+
end)
|
255
|
+
}
|
84
256
|
|
85
|
-
"
|
257
|
+
resource = resources[args.keys.sort.join(":")]
|
258
|
+
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
|
259
|
+
resource.call(**args)
|
86
260
|
end
|
87
261
|
|
88
262
|
##
|
89
263
|
# Create a fully-qualified Recommender resource string.
|
90
264
|
#
|
91
|
-
#
|
265
|
+
# @overload recommender_path(project:, location:, recommender:)
|
266
|
+
# The resource will be in the following format:
|
92
267
|
#
|
93
|
-
#
|
268
|
+
# `projects/{project}/locations/{location}/recommenders/{recommender}`
|
94
269
|
#
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
270
|
+
# @param project [String]
|
271
|
+
# @param location [String]
|
272
|
+
# @param recommender [String]
|
273
|
+
#
|
274
|
+
# @overload recommender_path(billing_account:, location:, recommender:)
|
275
|
+
# The resource will be in the following format:
|
276
|
+
#
|
277
|
+
# `billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}`
|
278
|
+
#
|
279
|
+
# @param billing_account [String]
|
280
|
+
# @param location [String]
|
281
|
+
# @param recommender [String]
|
282
|
+
#
|
283
|
+
# @overload recommender_path(folder:, location:, recommender:)
|
284
|
+
# The resource will be in the following format:
|
285
|
+
#
|
286
|
+
# `folders/{folder}/locations/{location}/recommenders/{recommender}`
|
287
|
+
#
|
288
|
+
# @param folder [String]
|
289
|
+
# @param location [String]
|
290
|
+
# @param recommender [String]
|
291
|
+
#
|
292
|
+
# @overload recommender_path(organization:, location:, recommender:)
|
293
|
+
# The resource will be in the following format:
|
294
|
+
#
|
295
|
+
# `organizations/{organization}/locations/{location}/recommenders/{recommender}`
|
296
|
+
#
|
297
|
+
# @param organization [String]
|
298
|
+
# @param location [String]
|
299
|
+
# @param recommender [String]
|
98
300
|
#
|
99
301
|
# @return [::String]
|
100
|
-
def recommender_path
|
101
|
-
|
102
|
-
|
302
|
+
def recommender_path **args
|
303
|
+
resources = {
|
304
|
+
"location:project:recommender" => (proc do |project:, location:, recommender:|
|
305
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
306
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
307
|
+
|
308
|
+
"projects/#{project}/locations/#{location}/recommenders/#{recommender}"
|
309
|
+
end),
|
310
|
+
"billing_account:location:recommender" => (proc do |billing_account:, location:, recommender:|
|
311
|
+
raise ::ArgumentError, "billing_account cannot contain /" if billing_account.to_s.include? "/"
|
312
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
313
|
+
|
314
|
+
"billingAccounts/#{billing_account}/locations/#{location}/recommenders/#{recommender}"
|
315
|
+
end),
|
316
|
+
"folder:location:recommender" => (proc do |folder:, location:, recommender:|
|
317
|
+
raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
|
318
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
319
|
+
|
320
|
+
"folders/#{folder}/locations/#{location}/recommenders/#{recommender}"
|
321
|
+
end),
|
322
|
+
"location:organization:recommender" => (proc do |organization:, location:, recommender:|
|
323
|
+
raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
|
324
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
325
|
+
|
326
|
+
"organizations/#{organization}/locations/#{location}/recommenders/#{recommender}"
|
327
|
+
end)
|
328
|
+
}
|
103
329
|
|
104
|
-
"
|
330
|
+
resource = resources[args.keys.sort.join(":")]
|
331
|
+
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
|
332
|
+
resource.call(**args)
|
105
333
|
end
|
106
334
|
|
107
335
|
extend self
|