google-apis-apikeys_v2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Apis
17
+ module ApikeysV2
18
+ # Version of the google-apis-apikeys_v2 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.2.0"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20210417"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,251 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module ApikeysV2
24
+
25
+ class Operation
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class Status
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class V2AndroidApplication
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class V2AndroidKeyRestrictions
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class V2ApiTarget
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class V2BrowserKeyRestrictions
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class V2CloneKeyRequest
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class V2GetKeyStringResponse
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class V2IosKeyRestrictions
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class V2Key
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class V2ListKeysResponse
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+
88
+ include Google::Apis::Core::JsonObjectSupport
89
+ end
90
+
91
+ class V2LookupKeyResponse
92
+ class Representation < Google::Apis::Core::JsonRepresentation; end
93
+
94
+ include Google::Apis::Core::JsonObjectSupport
95
+ end
96
+
97
+ class V2Restrictions
98
+ class Representation < Google::Apis::Core::JsonRepresentation; end
99
+
100
+ include Google::Apis::Core::JsonObjectSupport
101
+ end
102
+
103
+ class V2ServerKeyRestrictions
104
+ class Representation < Google::Apis::Core::JsonRepresentation; end
105
+
106
+ include Google::Apis::Core::JsonObjectSupport
107
+ end
108
+
109
+ class V2UndeleteKeyRequest
110
+ class Representation < Google::Apis::Core::JsonRepresentation; end
111
+
112
+ include Google::Apis::Core::JsonObjectSupport
113
+ end
114
+
115
+ class Operation
116
+ # @private
117
+ class Representation < Google::Apis::Core::JsonRepresentation
118
+ property :done, as: 'done'
119
+ property :error, as: 'error', class: Google::Apis::ApikeysV2::Status, decorator: Google::Apis::ApikeysV2::Status::Representation
120
+
121
+ hash :metadata, as: 'metadata'
122
+ property :name, as: 'name'
123
+ hash :response, as: 'response'
124
+ end
125
+ end
126
+
127
+ class Status
128
+ # @private
129
+ class Representation < Google::Apis::Core::JsonRepresentation
130
+ property :code, as: 'code'
131
+ collection :details, as: 'details'
132
+ property :message, as: 'message'
133
+ end
134
+ end
135
+
136
+ class V2AndroidApplication
137
+ # @private
138
+ class Representation < Google::Apis::Core::JsonRepresentation
139
+ property :package_name, as: 'packageName'
140
+ property :sha1_fingerprint, as: 'sha1Fingerprint'
141
+ end
142
+ end
143
+
144
+ class V2AndroidKeyRestrictions
145
+ # @private
146
+ class Representation < Google::Apis::Core::JsonRepresentation
147
+ collection :allowed_applications, as: 'allowedApplications', class: Google::Apis::ApikeysV2::V2AndroidApplication, decorator: Google::Apis::ApikeysV2::V2AndroidApplication::Representation
148
+
149
+ end
150
+ end
151
+
152
+ class V2ApiTarget
153
+ # @private
154
+ class Representation < Google::Apis::Core::JsonRepresentation
155
+ collection :methods_prop, as: 'methods'
156
+ property :service, as: 'service'
157
+ end
158
+ end
159
+
160
+ class V2BrowserKeyRestrictions
161
+ # @private
162
+ class Representation < Google::Apis::Core::JsonRepresentation
163
+ collection :allowed_referrers, as: 'allowedReferrers'
164
+ end
165
+ end
166
+
167
+ class V2CloneKeyRequest
168
+ # @private
169
+ class Representation < Google::Apis::Core::JsonRepresentation
170
+ property :key_id, as: 'keyId'
171
+ end
172
+ end
173
+
174
+ class V2GetKeyStringResponse
175
+ # @private
176
+ class Representation < Google::Apis::Core::JsonRepresentation
177
+ property :key_string, as: 'keyString'
178
+ end
179
+ end
180
+
181
+ class V2IosKeyRestrictions
182
+ # @private
183
+ class Representation < Google::Apis::Core::JsonRepresentation
184
+ collection :allowed_bundle_ids, as: 'allowedBundleIds'
185
+ end
186
+ end
187
+
188
+ class V2Key
189
+ # @private
190
+ class Representation < Google::Apis::Core::JsonRepresentation
191
+ property :create_time, as: 'createTime'
192
+ property :delete_time, as: 'deleteTime'
193
+ property :display_name, as: 'displayName'
194
+ property :etag, as: 'etag'
195
+ property :key_string, as: 'keyString'
196
+ property :name, as: 'name'
197
+ property :restrictions, as: 'restrictions', class: Google::Apis::ApikeysV2::V2Restrictions, decorator: Google::Apis::ApikeysV2::V2Restrictions::Representation
198
+
199
+ property :uid, as: 'uid'
200
+ property :update_time, as: 'updateTime'
201
+ end
202
+ end
203
+
204
+ class V2ListKeysResponse
205
+ # @private
206
+ class Representation < Google::Apis::Core::JsonRepresentation
207
+ collection :keys, as: 'keys', class: Google::Apis::ApikeysV2::V2Key, decorator: Google::Apis::ApikeysV2::V2Key::Representation
208
+
209
+ property :next_page_token, as: 'nextPageToken'
210
+ end
211
+ end
212
+
213
+ class V2LookupKeyResponse
214
+ # @private
215
+ class Representation < Google::Apis::Core::JsonRepresentation
216
+ property :name, as: 'name'
217
+ property :parent, as: 'parent'
218
+ end
219
+ end
220
+
221
+ class V2Restrictions
222
+ # @private
223
+ class Representation < Google::Apis::Core::JsonRepresentation
224
+ property :android_key_restrictions, as: 'androidKeyRestrictions', class: Google::Apis::ApikeysV2::V2AndroidKeyRestrictions, decorator: Google::Apis::ApikeysV2::V2AndroidKeyRestrictions::Representation
225
+
226
+ collection :api_targets, as: 'apiTargets', class: Google::Apis::ApikeysV2::V2ApiTarget, decorator: Google::Apis::ApikeysV2::V2ApiTarget::Representation
227
+
228
+ property :browser_key_restrictions, as: 'browserKeyRestrictions', class: Google::Apis::ApikeysV2::V2BrowserKeyRestrictions, decorator: Google::Apis::ApikeysV2::V2BrowserKeyRestrictions::Representation
229
+
230
+ property :ios_key_restrictions, as: 'iosKeyRestrictions', class: Google::Apis::ApikeysV2::V2IosKeyRestrictions, decorator: Google::Apis::ApikeysV2::V2IosKeyRestrictions::Representation
231
+
232
+ property :server_key_restrictions, as: 'serverKeyRestrictions', class: Google::Apis::ApikeysV2::V2ServerKeyRestrictions, decorator: Google::Apis::ApikeysV2::V2ServerKeyRestrictions::Representation
233
+
234
+ end
235
+ end
236
+
237
+ class V2ServerKeyRestrictions
238
+ # @private
239
+ class Representation < Google::Apis::Core::JsonRepresentation
240
+ collection :allowed_ips, as: 'allowedIps'
241
+ end
242
+ end
243
+
244
+ class V2UndeleteKeyRequest
245
+ # @private
246
+ class Representation < Google::Apis::Core::JsonRepresentation
247
+ end
248
+ end
249
+ end
250
+ end
251
+ end
@@ -0,0 +1,425 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module ApikeysV2
23
+ # API Keys API
24
+ #
25
+ # Manages the API keys associated with developer projects.
26
+ #
27
+ # @example
28
+ # require 'google/apis/apikeys_v2'
29
+ #
30
+ # Apikeys = Google::Apis::ApikeysV2 # Alias the module
31
+ # service = Apikeys::ApiKeysServiceService.new
32
+ #
33
+ # @see https://cloud.google.com/api-keys/docs
34
+ class ApiKeysServiceService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://apikeys.googleapis.com/', '',
47
+ client_name: 'google-apis-apikeys_v2',
48
+ client_version: Google::Apis::ApikeysV2::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Find the parent project and resource name of the API key that matches the key
53
+ # string in the request. If the API key has been purged, resource name will not
54
+ # be set. The service account must have the `apikeys.keys.lookup` permission on
55
+ # the parent project.
56
+ # @param [String] key_string
57
+ # Required. Finds the project that owns the key string value.
58
+ # @param [String] fields
59
+ # Selector specifying which fields to include in a partial response.
60
+ # @param [String] quota_user
61
+ # Available to use for quota purposes for server-side applications. Can be any
62
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
63
+ # @param [Google::Apis::RequestOptions] options
64
+ # Request-specific options
65
+ #
66
+ # @yield [result, err] Result & error if block supplied
67
+ # @yieldparam result [Google::Apis::ApikeysV2::V2LookupKeyResponse] parsed result object
68
+ # @yieldparam err [StandardError] error object if request failed
69
+ #
70
+ # @return [Google::Apis::ApikeysV2::V2LookupKeyResponse]
71
+ #
72
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
73
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
74
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
75
+ def lookup_key_key(key_string: nil, fields: nil, quota_user: nil, options: nil, &block)
76
+ command = make_simple_command(:get, 'v2/keys:lookupKey', options)
77
+ command.response_representation = Google::Apis::ApikeysV2::V2LookupKeyResponse::Representation
78
+ command.response_class = Google::Apis::ApikeysV2::V2LookupKeyResponse
79
+ command.query['keyString'] = key_string unless key_string.nil?
80
+ command.query['fields'] = fields unless fields.nil?
81
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
82
+ execute_or_queue_command(command, &block)
83
+ end
84
+
85
+ # Gets the latest state of a long-running operation. Clients can use this method
86
+ # to poll the operation result at intervals as recommended by the API service.
87
+ # @param [String] name
88
+ # The name of the operation resource.
89
+ # @param [String] fields
90
+ # Selector specifying which fields to include in a partial response.
91
+ # @param [String] quota_user
92
+ # Available to use for quota purposes for server-side applications. Can be any
93
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
94
+ # @param [Google::Apis::RequestOptions] options
95
+ # Request-specific options
96
+ #
97
+ # @yield [result, err] Result & error if block supplied
98
+ # @yieldparam result [Google::Apis::ApikeysV2::Operation] parsed result object
99
+ # @yieldparam err [StandardError] error object if request failed
100
+ #
101
+ # @return [Google::Apis::ApikeysV2::Operation]
102
+ #
103
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
104
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
105
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
106
+ def get_operation(name, fields: nil, quota_user: nil, options: nil, &block)
107
+ command = make_simple_command(:get, 'v2/{+name}', options)
108
+ command.response_representation = Google::Apis::ApikeysV2::Operation::Representation
109
+ command.response_class = Google::Apis::ApikeysV2::Operation
110
+ command.params['name'] = name unless name.nil?
111
+ command.query['fields'] = fields unless fields.nil?
112
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
113
+ execute_or_queue_command(command, &block)
114
+ end
115
+
116
+ # Clones the existing key's restriction and display name to a new API key. The
117
+ # service account must have the `apikeys.keys.get` and `apikeys.keys.create`
118
+ # permissions in the project. NOTE: Key is a global resource; hence the only
119
+ # supported value for location is `global`.
120
+ # @param [String] name
121
+ # Required. The resource name of the API key to be cloned in the same project.
122
+ # @param [Google::Apis::ApikeysV2::V2CloneKeyRequest] v2_clone_key_request_object
123
+ # @param [String] fields
124
+ # Selector specifying which fields to include in a partial response.
125
+ # @param [String] quota_user
126
+ # Available to use for quota purposes for server-side applications. Can be any
127
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
128
+ # @param [Google::Apis::RequestOptions] options
129
+ # Request-specific options
130
+ #
131
+ # @yield [result, err] Result & error if block supplied
132
+ # @yieldparam result [Google::Apis::ApikeysV2::Operation] parsed result object
133
+ # @yieldparam err [StandardError] error object if request failed
134
+ #
135
+ # @return [Google::Apis::ApikeysV2::Operation]
136
+ #
137
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
138
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
139
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
140
+ def clone_project_location_key(name, v2_clone_key_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
141
+ command = make_simple_command(:post, 'v2/{+name}:clone', options)
142
+ command.request_representation = Google::Apis::ApikeysV2::V2CloneKeyRequest::Representation
143
+ command.request_object = v2_clone_key_request_object
144
+ command.response_representation = Google::Apis::ApikeysV2::Operation::Representation
145
+ command.response_class = Google::Apis::ApikeysV2::Operation
146
+ command.params['name'] = name unless name.nil?
147
+ command.query['fields'] = fields unless fields.nil?
148
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
149
+ execute_or_queue_command(command, &block)
150
+ end
151
+
152
+ # Creates a new API key. NOTE: Key is a global resource; hence the only
153
+ # supported value for location is `global`.
154
+ # @param [String] parent
155
+ # Required. The project in which the API key is created.
156
+ # @param [Google::Apis::ApikeysV2::V2Key] v2_key_object
157
+ # @param [String] key_id
158
+ # User specified key id (optional). If specified, it will become the final
159
+ # component of the key resource name. The id must be unique within the project,
160
+ # must conform with RFC-1034, is restricted to lower-cased letters, and has a
161
+ # maximum length of 63 characters. In another word, the id must match the
162
+ # regular expression: `[a-z]([a-z0-9-]`0,61`[a-z0-9])?`. The id must NOT be a
163
+ # UUID-like string.
164
+ # @param [String] fields
165
+ # Selector specifying which fields to include in a partial response.
166
+ # @param [String] quota_user
167
+ # Available to use for quota purposes for server-side applications. Can be any
168
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
169
+ # @param [Google::Apis::RequestOptions] options
170
+ # Request-specific options
171
+ #
172
+ # @yield [result, err] Result & error if block supplied
173
+ # @yieldparam result [Google::Apis::ApikeysV2::Operation] parsed result object
174
+ # @yieldparam err [StandardError] error object if request failed
175
+ #
176
+ # @return [Google::Apis::ApikeysV2::Operation]
177
+ #
178
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
179
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
180
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
181
+ def create_project_location_key(parent, v2_key_object = nil, key_id: nil, fields: nil, quota_user: nil, options: nil, &block)
182
+ command = make_simple_command(:post, 'v2/{+parent}/keys', options)
183
+ command.request_representation = Google::Apis::ApikeysV2::V2Key::Representation
184
+ command.request_object = v2_key_object
185
+ command.response_representation = Google::Apis::ApikeysV2::Operation::Representation
186
+ command.response_class = Google::Apis::ApikeysV2::Operation
187
+ command.params['parent'] = parent unless parent.nil?
188
+ command.query['keyId'] = key_id unless key_id.nil?
189
+ command.query['fields'] = fields unless fields.nil?
190
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
191
+ execute_or_queue_command(command, &block)
192
+ end
193
+
194
+ # Deletes an API key. Deleted key can be retrieved within 30 days of deletion.
195
+ # Afterward, key will be purged from the project. NOTE: Key is a global resource;
196
+ # hence the only supported value for location is `global`.
197
+ # @param [String] name
198
+ # Required. The resource name of the API key to be deleted.
199
+ # @param [String] etag
200
+ # Optional. The etag known to the client for the expected state of the key. This
201
+ # is to be used for optimistic concurrency.
202
+ # @param [String] fields
203
+ # Selector specifying which fields to include in a partial response.
204
+ # @param [String] quota_user
205
+ # Available to use for quota purposes for server-side applications. Can be any
206
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
207
+ # @param [Google::Apis::RequestOptions] options
208
+ # Request-specific options
209
+ #
210
+ # @yield [result, err] Result & error if block supplied
211
+ # @yieldparam result [Google::Apis::ApikeysV2::Operation] parsed result object
212
+ # @yieldparam err [StandardError] error object if request failed
213
+ #
214
+ # @return [Google::Apis::ApikeysV2::Operation]
215
+ #
216
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
217
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
218
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
219
+ def delete_project_location_key(name, etag: nil, fields: nil, quota_user: nil, options: nil, &block)
220
+ command = make_simple_command(:delete, 'v2/{+name}', options)
221
+ command.response_representation = Google::Apis::ApikeysV2::Operation::Representation
222
+ command.response_class = Google::Apis::ApikeysV2::Operation
223
+ command.params['name'] = name unless name.nil?
224
+ command.query['etag'] = etag unless etag.nil?
225
+ command.query['fields'] = fields unless fields.nil?
226
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
227
+ execute_or_queue_command(command, &block)
228
+ end
229
+
230
+ # Gets the metadata for an API key. The key string of the API key isn't included
231
+ # in the response. NOTE: Key is a global resource; hence the only supported
232
+ # value for location is `global`.
233
+ # @param [String] name
234
+ # Required. The resource name of the API key to get.
235
+ # @param [String] fields
236
+ # Selector specifying which fields to include in a partial response.
237
+ # @param [String] quota_user
238
+ # Available to use for quota purposes for server-side applications. Can be any
239
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
240
+ # @param [Google::Apis::RequestOptions] options
241
+ # Request-specific options
242
+ #
243
+ # @yield [result, err] Result & error if block supplied
244
+ # @yieldparam result [Google::Apis::ApikeysV2::V2Key] parsed result object
245
+ # @yieldparam err [StandardError] error object if request failed
246
+ #
247
+ # @return [Google::Apis::ApikeysV2::V2Key]
248
+ #
249
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
250
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
251
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
252
+ def get_project_location_key(name, fields: nil, quota_user: nil, options: nil, &block)
253
+ command = make_simple_command(:get, 'v2/{+name}', options)
254
+ command.response_representation = Google::Apis::ApikeysV2::V2Key::Representation
255
+ command.response_class = Google::Apis::ApikeysV2::V2Key
256
+ command.params['name'] = name unless name.nil?
257
+ command.query['fields'] = fields unless fields.nil?
258
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
259
+ execute_or_queue_command(command, &block)
260
+ end
261
+
262
+ # Get the key string for an API key. NOTE: Key is a global resource; hence the
263
+ # only supported value for location is `global`.
264
+ # @param [String] name
265
+ # Required. The resource name of the API key to be retrieved.
266
+ # @param [String] fields
267
+ # Selector specifying which fields to include in a partial response.
268
+ # @param [String] quota_user
269
+ # Available to use for quota purposes for server-side applications. Can be any
270
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
271
+ # @param [Google::Apis::RequestOptions] options
272
+ # Request-specific options
273
+ #
274
+ # @yield [result, err] Result & error if block supplied
275
+ # @yieldparam result [Google::Apis::ApikeysV2::V2GetKeyStringResponse] parsed result object
276
+ # @yieldparam err [StandardError] error object if request failed
277
+ #
278
+ # @return [Google::Apis::ApikeysV2::V2GetKeyStringResponse]
279
+ #
280
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
281
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
282
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
283
+ def get_project_location_key_key_string(name, fields: nil, quota_user: nil, options: nil, &block)
284
+ command = make_simple_command(:get, 'v2/{+name}/keyString', options)
285
+ command.response_representation = Google::Apis::ApikeysV2::V2GetKeyStringResponse::Representation
286
+ command.response_class = Google::Apis::ApikeysV2::V2GetKeyStringResponse
287
+ command.params['name'] = name unless name.nil?
288
+ command.query['fields'] = fields unless fields.nil?
289
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
290
+ execute_or_queue_command(command, &block)
291
+ end
292
+
293
+ # Lists the API keys owned by a project. The key string of the API key isn't
294
+ # included in the response. NOTE: Key is a global resource; hence the only
295
+ # supported value for location is `global`.
296
+ # @param [String] parent
297
+ # Required. Lists all API keys associated with this project.
298
+ # @param [String] filter
299
+ # Optional. Only list keys that conform to the specified filter. The allowed
300
+ # filter strings are `state:ACTIVE` and `state:DELETED`. By default, ListKeys
301
+ # returns only active keys.
302
+ # @param [Fixnum] page_size
303
+ # Optional. Specifies the maximum number of results to be returned at a time.
304
+ # @param [String] page_token
305
+ # Optional. Requests a specific page of results.
306
+ # @param [String] fields
307
+ # Selector specifying which fields to include in a partial response.
308
+ # @param [String] quota_user
309
+ # Available to use for quota purposes for server-side applications. Can be any
310
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
311
+ # @param [Google::Apis::RequestOptions] options
312
+ # Request-specific options
313
+ #
314
+ # @yield [result, err] Result & error if block supplied
315
+ # @yieldparam result [Google::Apis::ApikeysV2::V2ListKeysResponse] parsed result object
316
+ # @yieldparam err [StandardError] error object if request failed
317
+ #
318
+ # @return [Google::Apis::ApikeysV2::V2ListKeysResponse]
319
+ #
320
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
321
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
322
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
323
+ def list_project_location_keys(parent, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
324
+ command = make_simple_command(:get, 'v2/{+parent}/keys', options)
325
+ command.response_representation = Google::Apis::ApikeysV2::V2ListKeysResponse::Representation
326
+ command.response_class = Google::Apis::ApikeysV2::V2ListKeysResponse
327
+ command.params['parent'] = parent unless parent.nil?
328
+ command.query['filter'] = filter unless filter.nil?
329
+ command.query['pageSize'] = page_size unless page_size.nil?
330
+ command.query['pageToken'] = page_token unless page_token.nil?
331
+ command.query['fields'] = fields unless fields.nil?
332
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
333
+ execute_or_queue_command(command, &block)
334
+ end
335
+
336
+ # Patches the modifiable fields of an API key. The key string of the API key isn'
337
+ # t included in the response. NOTE: Key is a global resource; hence the only
338
+ # supported value for location is `global`.
339
+ # @param [String] name
340
+ # Output only. The resource name of the key. The `name` has the form: `projects//
341
+ # locations/global/keys/`. For example: `projects/123456867718/locations/global/
342
+ # keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2` NOTE: Key is a global resource;
343
+ # hence the only supported value for location is `global`.
344
+ # @param [Google::Apis::ApikeysV2::V2Key] v2_key_object
345
+ # @param [String] update_mask
346
+ # The field mask specifies which fields to be updated as part of this request.
347
+ # All other fields are ignored. Mutable fields are: `display_name` and `
348
+ # restrictions`. If an update mask is not provided, the service treats it as an
349
+ # implied mask equivalent to all allowed fields that are set on the wire. If the
350
+ # field mask has a special value "*", the service treats it equivalent to
351
+ # replace all allowed mutable fields.
352
+ # @param [String] fields
353
+ # Selector specifying which fields to include in a partial response.
354
+ # @param [String] quota_user
355
+ # Available to use for quota purposes for server-side applications. Can be any
356
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
357
+ # @param [Google::Apis::RequestOptions] options
358
+ # Request-specific options
359
+ #
360
+ # @yield [result, err] Result & error if block supplied
361
+ # @yieldparam result [Google::Apis::ApikeysV2::Operation] parsed result object
362
+ # @yieldparam err [StandardError] error object if request failed
363
+ #
364
+ # @return [Google::Apis::ApikeysV2::Operation]
365
+ #
366
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
367
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
368
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
369
+ def patch_project_location_key(name, v2_key_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
370
+ command = make_simple_command(:patch, 'v2/{+name}', options)
371
+ command.request_representation = Google::Apis::ApikeysV2::V2Key::Representation
372
+ command.request_object = v2_key_object
373
+ command.response_representation = Google::Apis::ApikeysV2::Operation::Representation
374
+ command.response_class = Google::Apis::ApikeysV2::Operation
375
+ command.params['name'] = name unless name.nil?
376
+ command.query['updateMask'] = update_mask unless update_mask.nil?
377
+ command.query['fields'] = fields unless fields.nil?
378
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
379
+ execute_or_queue_command(command, &block)
380
+ end
381
+
382
+ # Undeletes an API key which was deleted within 30 days. NOTE: Key is a global
383
+ # resource; hence the only supported value for location is `global`.
384
+ # @param [String] name
385
+ # Required. The resource name of the API key to be undeleted.
386
+ # @param [Google::Apis::ApikeysV2::V2UndeleteKeyRequest] v2_undelete_key_request_object
387
+ # @param [String] fields
388
+ # Selector specifying which fields to include in a partial response.
389
+ # @param [String] quota_user
390
+ # Available to use for quota purposes for server-side applications. Can be any
391
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
392
+ # @param [Google::Apis::RequestOptions] options
393
+ # Request-specific options
394
+ #
395
+ # @yield [result, err] Result & error if block supplied
396
+ # @yieldparam result [Google::Apis::ApikeysV2::Operation] parsed result object
397
+ # @yieldparam err [StandardError] error object if request failed
398
+ #
399
+ # @return [Google::Apis::ApikeysV2::Operation]
400
+ #
401
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
402
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
403
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
404
+ def undelete_project_location_key(name, v2_undelete_key_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
405
+ command = make_simple_command(:post, 'v2/{+name}:undelete', options)
406
+ command.request_representation = Google::Apis::ApikeysV2::V2UndeleteKeyRequest::Representation
407
+ command.request_object = v2_undelete_key_request_object
408
+ command.response_representation = Google::Apis::ApikeysV2::Operation::Representation
409
+ command.response_class = Google::Apis::ApikeysV2::Operation
410
+ command.params['name'] = name unless name.nil?
411
+ command.query['fields'] = fields unless fields.nil?
412
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
413
+ execute_or_queue_command(command, &block)
414
+ end
415
+
416
+ protected
417
+
418
+ def apply_command_defaults(command)
419
+ command.query['key'] = key unless key.nil?
420
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
421
+ end
422
+ end
423
+ end
424
+ end
425
+ end