google-cloud-recommender-v1 0.1.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.
@@ -0,0 +1,306 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Recommender
23
+ module V1
24
+ # A recommendation along with a suggested action. E.g., a rightsizing
25
+ # recommendation for an underutilized VM, IAM role recommendations, etc
26
+ # @!attribute [rw] name
27
+ # @return [String]
28
+ # Name of recommendation.
29
+ # @!attribute [rw] description
30
+ # @return [String]
31
+ # Free-form human readable summary in English. The maximum length is 500
32
+ # characters.
33
+ # @!attribute [rw] recommender_subtype
34
+ # @return [String]
35
+ # Contains an identifier for a subtype of recommendations produced for the
36
+ # same recommender. Subtype is a function of content and impact, meaning a
37
+ # new subtype might be added when significant changes to `content` or
38
+ # `primary_impact.category` are introduced. See the Recommenders section
39
+ # to see a list of subtypes for a given Recommender.
40
+ #
41
+ # Examples:
42
+ # For recommender = "google.iam.policy.Recommender",
43
+ # recommender_subtype can be one of "REMOVE_ROLE"/"REPLACE_ROLE"
44
+ # @!attribute [rw] last_refresh_time
45
+ # @return [Google::Protobuf::Timestamp]
46
+ # Last time this recommendation was refreshed by the system that created it
47
+ # in the first place.
48
+ # @!attribute [rw] primary_impact
49
+ # @return [Google::Cloud::Recommender::V1::Impact]
50
+ # The primary impact that this recommendation can have while trying to
51
+ # optimize for one category.
52
+ # @!attribute [rw] additional_impact
53
+ # @return [Array<Google::Cloud::Recommender::V1::Impact>]
54
+ # Optional set of additional impact that this recommendation may have when
55
+ # trying to optimize for the primary category. These may be positive
56
+ # or negative.
57
+ # @!attribute [rw] content
58
+ # @return [Google::Cloud::Recommender::V1::RecommendationContent]
59
+ # Content of the recommendation describing recommended changes to resources.
60
+ # @!attribute [rw] state_info
61
+ # @return [Google::Cloud::Recommender::V1::RecommendationStateInfo]
62
+ # Information for state. Contains state and metadata.
63
+ # @!attribute [rw] etag
64
+ # @return [String]
65
+ # Fingerprint of the Recommendation. Provides optimistic locking when
66
+ # updating states.
67
+ class Recommendation
68
+ include Google::Protobuf::MessageExts
69
+ extend Google::Protobuf::MessageExts::ClassMethods
70
+ end
71
+
72
+ # Contains what resources are changing and how they are changing.
73
+ # @!attribute [rw] operation_groups
74
+ # @return [Array<Google::Cloud::Recommender::V1::OperationGroup>]
75
+ # Operations to one or more Google Cloud resources grouped in such a way
76
+ # that, all operations within one group are expected to be performed
77
+ # atomically and in an order.
78
+ class RecommendationContent
79
+ include Google::Protobuf::MessageExts
80
+ extend Google::Protobuf::MessageExts::ClassMethods
81
+ end
82
+
83
+ # Group of operations that need to be performed atomically.
84
+ # @!attribute [rw] operations
85
+ # @return [Array<Google::Cloud::Recommender::V1::Operation>]
86
+ # List of operations across one or more resources that belong to this group.
87
+ # Loosely based on RFC6902 and should be performed in the order they appear.
88
+ class OperationGroup
89
+ include Google::Protobuf::MessageExts
90
+ extend Google::Protobuf::MessageExts::ClassMethods
91
+ end
92
+
93
+ # Contains an operation for a resource loosely based on the JSON-PATCH format
94
+ # with support for:
95
+ #
96
+ # * Custom filters for describing partial array patch.
97
+ # * Extended path values for describing nested arrays.
98
+ # * Custom fields for describing the resource for which the operation is being
99
+ # described.
100
+ # * Allows extension to custom operations not natively supported by RFC6902.
101
+ # See https://tools.ietf.org/html/rfc6902 for details on the original RFC.
102
+ # @!attribute [rw] action
103
+ # @return [String]
104
+ # Type of this operation. Contains one of 'and', 'remove', 'replace', 'move',
105
+ # 'copy', 'test' and custom operations. This field is case-insensitive and
106
+ # always populated.
107
+ # @!attribute [rw] resource_type
108
+ # @return [String]
109
+ # Type of GCP resource being modified/tested. This field is always populated.
110
+ # Example: cloudresourcemanager.googleapis.com/Project,
111
+ # compute.googleapis.com/Instance
112
+ # @!attribute [rw] resource
113
+ # @return [String]
114
+ # Contains the fully qualified resource name. This field is always populated.
115
+ # ex: //cloudresourcemanager.googleapis.com/projects/foo.
116
+ # @!attribute [rw] path
117
+ # @return [String]
118
+ # Path to the target field being operated on. If the operation is at the
119
+ # resource level, then path should be "/". This field is always populated.
120
+ # @!attribute [rw] source_resource
121
+ # @return [String]
122
+ # Can be set with action 'copy' to copy resource configuration across
123
+ # different resources of the same type. Example: A resource clone can be
124
+ # done via action = 'copy', path = "/", from = "/",
125
+ # source_resource = <source> and resource_name = <target>.
126
+ # This field is empty for all other values of `action`.
127
+ # @!attribute [rw] source_path
128
+ # @return [String]
129
+ # Can be set with action 'copy' or 'move' to indicate the source field within
130
+ # resource or source_resource, ignored if provided for other operation types.
131
+ # @!attribute [rw] value
132
+ # @return [Google::Protobuf::Value]
133
+ # Value for the `path` field. Will be set for actions:'add'/'replace'.
134
+ # Maybe set for action: 'test'. Either this or `value_matcher` will be set
135
+ # for 'test' operation. An exact match must be performed.
136
+ # @!attribute [rw] value_matcher
137
+ # @return [Google::Cloud::Recommender::V1::ValueMatcher]
138
+ # Can be set for action 'test' for advanced matching for the value of
139
+ # 'path' field. Either this or `value` will be set for 'test' operation.
140
+ # @!attribute [rw] path_filters
141
+ # @return [Google::Protobuf::Map{String => Google::Protobuf::Value}]
142
+ # Set of filters to apply if `path` refers to array elements or nested array
143
+ # elements in order to narrow down to a single unique element that is being
144
+ # tested/modified.
145
+ # This is intended to be an exact match per filter. To perform advanced
146
+ # matching, use path_value_matchers.
147
+ #
148
+ # * Example: \\\{
149
+ # "/versions/*/name" : "it-123"
150
+ # "/versions/*/targetSize/percent": 20
151
+ # \}
152
+ # * Example: \\\{
153
+ # "/bindings/*/role": "roles/admin"
154
+ # "/bindings/*/condition" : null
155
+ # \}
156
+ # * Example: \\\{
157
+ # "/bindings/*/role": "roles/admin"
158
+ # "/bindings/*/members/*" : ["x@google.com", "y@google.com"]
159
+ # \}
160
+ # When both path_filters and path_value_matchers are set, an implicit AND
161
+ # must be performed.
162
+ # @!attribute [rw] path_value_matchers
163
+ # @return [Google::Protobuf::Map{String => Google::Cloud::Recommender::V1::ValueMatcher}]
164
+ # Similar to path_filters, this contains set of filters to apply if `path`
165
+ # field referes to array elements. This is meant to support value matching
166
+ # beyond exact match. To perform exact match, use path_filters.
167
+ # When both path_filters and path_value_matchers are set, an implicit AND
168
+ # must be performed.
169
+ class Operation
170
+ include Google::Protobuf::MessageExts
171
+ extend Google::Protobuf::MessageExts::ClassMethods
172
+
173
+ # @!attribute [rw] key
174
+ # @return [String]
175
+ # @!attribute [rw] value
176
+ # @return [Google::Protobuf::Value]
177
+ class PathFiltersEntry
178
+ include Google::Protobuf::MessageExts
179
+ extend Google::Protobuf::MessageExts::ClassMethods
180
+ end
181
+
182
+ # @!attribute [rw] key
183
+ # @return [String]
184
+ # @!attribute [rw] value
185
+ # @return [Google::Cloud::Recommender::V1::ValueMatcher]
186
+ class PathValueMatchersEntry
187
+ include Google::Protobuf::MessageExts
188
+ extend Google::Protobuf::MessageExts::ClassMethods
189
+ end
190
+ end
191
+
192
+ # Contains various matching options for values for a GCP resource field.
193
+ # @!attribute [rw] matches_pattern
194
+ # @return [String]
195
+ # To be used for full regex matching. The regular expression is using the
196
+ # Google RE2 syntax (https://github.com/google/re2/wiki/Syntax), so to be
197
+ # used with RE2::FullMatch
198
+ class ValueMatcher
199
+ include Google::Protobuf::MessageExts
200
+ extend Google::Protobuf::MessageExts::ClassMethods
201
+ end
202
+
203
+ # Contains metadata about how much money a recommendation can save or incur.
204
+ # @!attribute [rw] cost
205
+ # @return [Google::Type::Money]
206
+ # An approximate projection on amount saved or amount incurred. Negative cost
207
+ # units indicate cost savings and positive cost units indicate increase.
208
+ # See google.type.Money documentation for positive/negative units.
209
+ # @!attribute [rw] duration
210
+ # @return [Google::Protobuf::Duration]
211
+ # Duration for which this cost applies.
212
+ class CostProjection
213
+ include Google::Protobuf::MessageExts
214
+ extend Google::Protobuf::MessageExts::ClassMethods
215
+ end
216
+
217
+ # Contains the impact a recommendation can have for a given category.
218
+ # @!attribute [rw] category
219
+ # @return [ENUM(Category)]
220
+ # Category that is being targeted.
221
+ # @!attribute [rw] cost_projection
222
+ # @return [Google::Cloud::Recommender::V1::CostProjection]
223
+ # Use with CategoryType.COST
224
+ class Impact
225
+ include Google::Protobuf::MessageExts
226
+ extend Google::Protobuf::MessageExts::ClassMethods
227
+
228
+ # The category of the impact.
229
+ module Category
230
+ # Default unspecified category. Don't use directly.
231
+ CATEGORY_UNSPECIFIED = 0
232
+
233
+ # Indicates a potential increase or decrease in cost.
234
+ COST = 1
235
+
236
+ # Indicates a potential increase or decrease in security.
237
+ SECURITY = 2
238
+
239
+ # Indicates a potential increase or decrease in performance.
240
+ PERFORMANCE = 3
241
+
242
+ # Indicates a potential increase or decrease in manageability.
243
+ MANAGEABILITY = 4
244
+ end
245
+ end
246
+
247
+ # Information for state. Contains state and metadata.
248
+ # @!attribute [rw] state
249
+ # @return [ENUM(State)]
250
+ # The state of the recommendation, Eg ACTIVE, SUCCEEDED, FAILED.
251
+ # @!attribute [rw] state_metadata
252
+ # @return [Google::Protobuf::Map{String => String}]
253
+ # A map of metadata for the state, provided by user or automations systems.
254
+ class RecommendationStateInfo
255
+ include Google::Protobuf::MessageExts
256
+ extend Google::Protobuf::MessageExts::ClassMethods
257
+
258
+ # @!attribute [rw] key
259
+ # @return [String]
260
+ # @!attribute [rw] value
261
+ # @return [String]
262
+ class StateMetadataEntry
263
+ include Google::Protobuf::MessageExts
264
+ extend Google::Protobuf::MessageExts::ClassMethods
265
+ end
266
+
267
+ # Represents Recommendation State
268
+ module State
269
+ # Default state. Don't use directly.
270
+ STATE_UNSPECIFIED = 0
271
+
272
+ # Recommendation is active and can be applied. Recommendations content can
273
+ # be updated by Google.
274
+ #
275
+ # ACTIVE recommendations can be marked as CLAIMED, SUCCEEDED, or FAILED.
276
+ ACTIVE = 1
277
+
278
+ # Recommendation is in claimed state. Recommendations content is
279
+ # immutable and cannot be updated by Google.
280
+ #
281
+ # CLAIMED recommendations can be marked as CLAIMED, SUCCEEDED, or FAILED.
282
+ CLAIMED = 6
283
+
284
+ # Recommendation is in succeeded state. Recommendations content is
285
+ # immutable and cannot be updated by Google.
286
+ #
287
+ # SUCCEEDED recommendations can be marked as SUCCEEDED, or FAILED.
288
+ SUCCEEDED = 3
289
+
290
+ # Recommendation is in failed state. Recommendations content is immutable
291
+ # and cannot be updated by Google.
292
+ #
293
+ # FAILED recommendations can be marked as SUCCEEDED, or FAILED.
294
+ FAILED = 4
295
+
296
+ # Recommendation is in dismissed state. Recommendation content can be
297
+ # updated by Google.
298
+ #
299
+ # DISMISSED recommendations can be marked as ACTIVE.
300
+ DISMISSED = 5
301
+ end
302
+ end
303
+ end
304
+ end
305
+ end
306
+ end
@@ -0,0 +1,161 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Recommender
23
+ module V1
24
+ # Request for the `ListRecommendations` method.
25
+ # @!attribute [rw] parent
26
+ # @return [String]
27
+ # Required. The container resource on which to execute the request.
28
+ # Acceptable formats:
29
+ #
30
+ # 1.
31
+ # "projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]",
32
+ #
33
+ # LOCATION here refers to GCP Locations:
34
+ # https://cloud.google.com/about/locations/
35
+ # @!attribute [rw] page_size
36
+ # @return [Integer]
37
+ # Optional. The maximum number of results to return from this request. Non-positive
38
+ # values are ignored. If not specified, the server will determine the number
39
+ # of results to return.
40
+ # @!attribute [rw] page_token
41
+ # @return [String]
42
+ # Optional. If present, retrieves the next batch of results from the preceding call to
43
+ # this method. `page_token` must be the value of `next_page_token` from the
44
+ # previous response. The values of other method parameters must be identical
45
+ # to those in the previous call.
46
+ # @!attribute [rw] filter
47
+ # @return [String]
48
+ # Filter expression to restrict the recommendations returned. Supported
49
+ # filter fields: state_info.state
50
+ # Eg: `state_info.state:"DISMISSED" or state_info.state:"FAILED"
51
+ class ListRecommendationsRequest
52
+ include Google::Protobuf::MessageExts
53
+ extend Google::Protobuf::MessageExts::ClassMethods
54
+ end
55
+
56
+ # Response to the `ListRecommendations` method.
57
+ # @!attribute [rw] recommendations
58
+ # @return [Array<Google::Cloud::Recommender::V1::Recommendation>]
59
+ # The set of recommendations for the `parent` resource.
60
+ # @!attribute [rw] next_page_token
61
+ # @return [String]
62
+ # A token that can be used to request the next page of results. This field is
63
+ # empty if there are no additional results.
64
+ class ListRecommendationsResponse
65
+ include Google::Protobuf::MessageExts
66
+ extend Google::Protobuf::MessageExts::ClassMethods
67
+ end
68
+
69
+ # Request to the `GetRecommendation` method.
70
+ # @!attribute [rw] name
71
+ # @return [String]
72
+ # Required. Name of the recommendation.
73
+ class GetRecommendationRequest
74
+ include Google::Protobuf::MessageExts
75
+ extend Google::Protobuf::MessageExts::ClassMethods
76
+ end
77
+
78
+ # Request for the `MarkRecommendationClaimed` Method.
79
+ # @!attribute [rw] name
80
+ # @return [String]
81
+ # Required. Name of the recommendation.
82
+ # @!attribute [rw] state_metadata
83
+ # @return [Google::Protobuf::Map{String => String}]
84
+ # State properties to include with this state. Overwrites any existing
85
+ # `state_metadata`.
86
+ # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\\{0,62\}$/.
87
+ # Values must match the regex /^[a-zA-Z0-9_./-]\\\{0,255\}$/.
88
+ # @!attribute [rw] etag
89
+ # @return [String]
90
+ # Required. Fingerprint of the Recommendation. Provides optimistic locking.
91
+ class MarkRecommendationClaimedRequest
92
+ include Google::Protobuf::MessageExts
93
+ extend Google::Protobuf::MessageExts::ClassMethods
94
+
95
+ # @!attribute [rw] key
96
+ # @return [String]
97
+ # @!attribute [rw] value
98
+ # @return [String]
99
+ class StateMetadataEntry
100
+ include Google::Protobuf::MessageExts
101
+ extend Google::Protobuf::MessageExts::ClassMethods
102
+ end
103
+ end
104
+
105
+ # Request for the `MarkRecommendationSucceeded` Method.
106
+ # @!attribute [rw] name
107
+ # @return [String]
108
+ # Required. Name of the recommendation.
109
+ # @!attribute [rw] state_metadata
110
+ # @return [Google::Protobuf::Map{String => String}]
111
+ # State properties to include with this state. Overwrites any existing
112
+ # `state_metadata`.
113
+ # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\\{0,62\}$/.
114
+ # Values must match the regex /^[a-zA-Z0-9_./-]\\\{0,255\}$/.
115
+ # @!attribute [rw] etag
116
+ # @return [String]
117
+ # Required. Fingerprint of the Recommendation. Provides optimistic locking.
118
+ class MarkRecommendationSucceededRequest
119
+ include Google::Protobuf::MessageExts
120
+ extend Google::Protobuf::MessageExts::ClassMethods
121
+
122
+ # @!attribute [rw] key
123
+ # @return [String]
124
+ # @!attribute [rw] value
125
+ # @return [String]
126
+ class StateMetadataEntry
127
+ include Google::Protobuf::MessageExts
128
+ extend Google::Protobuf::MessageExts::ClassMethods
129
+ end
130
+ end
131
+
132
+ # Request for the `MarkRecommendationFailed` Method.
133
+ # @!attribute [rw] name
134
+ # @return [String]
135
+ # Required. Name of the recommendation.
136
+ # @!attribute [rw] state_metadata
137
+ # @return [Google::Protobuf::Map{String => String}]
138
+ # State properties to include with this state. Overwrites any existing
139
+ # `state_metadata`.
140
+ # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\\{0,62\}$/.
141
+ # Values must match the regex /^[a-zA-Z0-9_./-]\\\{0,255\}$/.
142
+ # @!attribute [rw] etag
143
+ # @return [String]
144
+ # Required. Fingerprint of the Recommendation. Provides optimistic locking.
145
+ class MarkRecommendationFailedRequest
146
+ include Google::Protobuf::MessageExts
147
+ extend Google::Protobuf::MessageExts::ClassMethods
148
+
149
+ # @!attribute [rw] key
150
+ # @return [String]
151
+ # @!attribute [rw] value
152
+ # @return [String]
153
+ class StateMetadataEntry
154
+ include Google::Protobuf::MessageExts
155
+ extend Google::Protobuf::MessageExts::ClassMethods
156
+ end
157
+ end
158
+ end
159
+ end
160
+ end
161
+ end