google-apis-cloudshell_v1alpha1 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,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 CloudshellV1alpha1
18
+ # Version of the google-apis-cloudshell_v1alpha1 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.1.1"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20200803"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,182 @@
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 CloudshellV1alpha1
24
+
25
+ class AuthorizeEnvironmentRequest
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class CreatePublicKeyRequest
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class Empty
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class Environment
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class Operation
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class PublicKey
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class StartEnvironmentMetadata
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class StartEnvironmentRequest
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class StartEnvironmentResponse
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class Status
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class AuthorizeEnvironmentRequest
86
+ # @private
87
+ class Representation < Google::Apis::Core::JsonRepresentation
88
+ property :access_token, as: 'accessToken'
89
+ property :expire_time, as: 'expireTime'
90
+ property :id_token, as: 'idToken'
91
+ end
92
+ end
93
+
94
+ class CreatePublicKeyRequest
95
+ # @private
96
+ class Representation < Google::Apis::Core::JsonRepresentation
97
+ property :key, as: 'key', class: Google::Apis::CloudshellV1alpha1::PublicKey, decorator: Google::Apis::CloudshellV1alpha1::PublicKey::Representation
98
+
99
+ end
100
+ end
101
+
102
+ class Empty
103
+ # @private
104
+ class Representation < Google::Apis::Core::JsonRepresentation
105
+ end
106
+ end
107
+
108
+ class Environment
109
+ # @private
110
+ class Representation < Google::Apis::Core::JsonRepresentation
111
+ property :docker_image, as: 'dockerImage'
112
+ property :id, as: 'id'
113
+ property :name, as: 'name'
114
+ collection :public_keys, as: 'publicKeys', class: Google::Apis::CloudshellV1alpha1::PublicKey, decorator: Google::Apis::CloudshellV1alpha1::PublicKey::Representation
115
+
116
+ property :size, as: 'size'
117
+ property :ssh_host, as: 'sshHost'
118
+ property :ssh_port, as: 'sshPort'
119
+ property :ssh_username, as: 'sshUsername'
120
+ property :state, as: 'state'
121
+ property :vm_size_expire_time, as: 'vmSizeExpireTime'
122
+ property :web_host, as: 'webHost'
123
+ collection :web_ports, as: 'webPorts'
124
+ end
125
+ end
126
+
127
+ class Operation
128
+ # @private
129
+ class Representation < Google::Apis::Core::JsonRepresentation
130
+ property :done, as: 'done'
131
+ property :error, as: 'error', class: Google::Apis::CloudshellV1alpha1::Status, decorator: Google::Apis::CloudshellV1alpha1::Status::Representation
132
+
133
+ hash :metadata, as: 'metadata'
134
+ property :name, as: 'name'
135
+ hash :response, as: 'response'
136
+ end
137
+ end
138
+
139
+ class PublicKey
140
+ # @private
141
+ class Representation < Google::Apis::Core::JsonRepresentation
142
+ property :format, as: 'format'
143
+ property :key, :base64 => true, as: 'key'
144
+ property :name, as: 'name'
145
+ end
146
+ end
147
+
148
+ class StartEnvironmentMetadata
149
+ # @private
150
+ class Representation < Google::Apis::Core::JsonRepresentation
151
+ property :state, as: 'state'
152
+ end
153
+ end
154
+
155
+ class StartEnvironmentRequest
156
+ # @private
157
+ class Representation < Google::Apis::Core::JsonRepresentation
158
+ property :access_token, as: 'accessToken'
159
+ collection :public_keys, as: 'publicKeys', class: Google::Apis::CloudshellV1alpha1::PublicKey, decorator: Google::Apis::CloudshellV1alpha1::PublicKey::Representation
160
+
161
+ end
162
+ end
163
+
164
+ class StartEnvironmentResponse
165
+ # @private
166
+ class Representation < Google::Apis::Core::JsonRepresentation
167
+ property :environment, as: 'environment', class: Google::Apis::CloudshellV1alpha1::Environment, decorator: Google::Apis::CloudshellV1alpha1::Environment::Representation
168
+
169
+ end
170
+ end
171
+
172
+ class Status
173
+ # @private
174
+ class Representation < Google::Apis::Core::JsonRepresentation
175
+ property :code, as: 'code'
176
+ collection :details, as: 'details'
177
+ property :message, as: 'message'
178
+ end
179
+ end
180
+ end
181
+ end
182
+ end
@@ -0,0 +1,273 @@
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 CloudshellV1alpha1
23
+ # Cloud Shell API
24
+ #
25
+ # Allows users to start, configure, and connect to interactive shell sessions
26
+ # running in the cloud.
27
+ #
28
+ # @example
29
+ # require 'google/apis/cloudshell_v1alpha1'
30
+ #
31
+ # Cloudshell = Google::Apis::CloudshellV1alpha1 # Alias the module
32
+ # service = Cloudshell::CloudShellService.new
33
+ #
34
+ # @see https://cloud.google.com/shell/docs/
35
+ class CloudShellService < Google::Apis::Core::BaseService
36
+ # @return [String]
37
+ # API key. Your API key identifies your project and provides you with API access,
38
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
39
+ attr_accessor :key
40
+
41
+ # @return [String]
42
+ # Available to use for quota purposes for server-side applications. Can be any
43
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
44
+ attr_accessor :quota_user
45
+
46
+ def initialize
47
+ super('https://cloudshell.googleapis.com/', '',
48
+ client_name: 'google-apis-cloudshell_v1alpha1',
49
+ client_version: Google::Apis::CloudshellV1alpha1::GEM_VERSION)
50
+ @batch_path = 'batch'
51
+ end
52
+
53
+ # Sends OAuth credentials to a running environment on behalf of a user. When
54
+ # this completes, the environment will be authorized to run various Google Cloud
55
+ # command line tools without requiring the user to manually authenticate.
56
+ # @param [String] name
57
+ # Name of the resource that should receive the credentials, for example `users/
58
+ # me/environments/default` or `users/someone@example.com/environments/default`.
59
+ # @param [Google::Apis::CloudshellV1alpha1::AuthorizeEnvironmentRequest] authorize_environment_request_object
60
+ # @param [String] fields
61
+ # Selector specifying which fields to include in a partial response.
62
+ # @param [String] quota_user
63
+ # Available to use for quota purposes for server-side applications. Can be any
64
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
65
+ # @param [Google::Apis::RequestOptions] options
66
+ # Request-specific options
67
+ #
68
+ # @yield [result, err] Result & error if block supplied
69
+ # @yieldparam result [Google::Apis::CloudshellV1alpha1::Empty] parsed result object
70
+ # @yieldparam err [StandardError] error object if request failed
71
+ #
72
+ # @return [Google::Apis::CloudshellV1alpha1::Empty]
73
+ #
74
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
75
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
76
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
77
+ def authorize_environment(name, authorize_environment_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
78
+ command = make_simple_command(:post, 'v1alpha1/{+name}:authorize', options)
79
+ command.request_representation = Google::Apis::CloudshellV1alpha1::AuthorizeEnvironmentRequest::Representation
80
+ command.request_object = authorize_environment_request_object
81
+ command.response_representation = Google::Apis::CloudshellV1alpha1::Empty::Representation
82
+ command.response_class = Google::Apis::CloudshellV1alpha1::Empty
83
+ command.params['name'] = name unless name.nil?
84
+ command.query['fields'] = fields unless fields.nil?
85
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
86
+ execute_or_queue_command(command, &block)
87
+ end
88
+
89
+ # Gets an environment. Returns NOT_FOUND if the environment does not exist.
90
+ # @param [String] name
91
+ # Name of the requested resource, for example `users/me/environments/default` or
92
+ # `users/someone@example.com/environments/default`.
93
+ # @param [String] fields
94
+ # Selector specifying which fields to include in a partial response.
95
+ # @param [String] quota_user
96
+ # Available to use for quota purposes for server-side applications. Can be any
97
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
98
+ # @param [Google::Apis::RequestOptions] options
99
+ # Request-specific options
100
+ #
101
+ # @yield [result, err] Result & error if block supplied
102
+ # @yieldparam result [Google::Apis::CloudshellV1alpha1::Environment] parsed result object
103
+ # @yieldparam err [StandardError] error object if request failed
104
+ #
105
+ # @return [Google::Apis::CloudshellV1alpha1::Environment]
106
+ #
107
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
108
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
109
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
110
+ def get_user_environment(name, fields: nil, quota_user: nil, options: nil, &block)
111
+ command = make_simple_command(:get, 'v1alpha1/{+name}', options)
112
+ command.response_representation = Google::Apis::CloudshellV1alpha1::Environment::Representation
113
+ command.response_class = Google::Apis::CloudshellV1alpha1::Environment
114
+ command.params['name'] = name unless name.nil?
115
+ command.query['fields'] = fields unless fields.nil?
116
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
117
+ execute_or_queue_command(command, &block)
118
+ end
119
+
120
+ # Updates an existing environment.
121
+ # @param [String] name
122
+ # Name of the resource to be updated, for example `users/me/environments/default`
123
+ # or `users/someone@example.com/environments/default`.
124
+ # @param [Google::Apis::CloudshellV1alpha1::Environment] environment_object
125
+ # @param [String] update_mask
126
+ # Mask specifying which fields in the environment should be updated.
127
+ # @param [String] fields
128
+ # Selector specifying which fields to include in a partial response.
129
+ # @param [String] quota_user
130
+ # Available to use for quota purposes for server-side applications. Can be any
131
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
132
+ # @param [Google::Apis::RequestOptions] options
133
+ # Request-specific options
134
+ #
135
+ # @yield [result, err] Result & error if block supplied
136
+ # @yieldparam result [Google::Apis::CloudshellV1alpha1::Environment] parsed result object
137
+ # @yieldparam err [StandardError] error object if request failed
138
+ #
139
+ # @return [Google::Apis::CloudshellV1alpha1::Environment]
140
+ #
141
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
142
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
143
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
144
+ def patch_user_environment(name, environment_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
145
+ command = make_simple_command(:patch, 'v1alpha1/{+name}', options)
146
+ command.request_representation = Google::Apis::CloudshellV1alpha1::Environment::Representation
147
+ command.request_object = environment_object
148
+ command.response_representation = Google::Apis::CloudshellV1alpha1::Environment::Representation
149
+ command.response_class = Google::Apis::CloudshellV1alpha1::Environment
150
+ command.params['name'] = name unless name.nil?
151
+ command.query['updateMask'] = update_mask unless update_mask.nil?
152
+ command.query['fields'] = fields unless fields.nil?
153
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
154
+ execute_or_queue_command(command, &block)
155
+ end
156
+
157
+ # Starts an existing environment, allowing clients to connect to it. The
158
+ # returned operation will contain an instance of StartEnvironmentMetadata in its
159
+ # metadata field. Users can wait for the environment to start by polling this
160
+ # operation via GetOperation. Once the environment has finished starting and is
161
+ # ready to accept connections, the operation will contain a
162
+ # StartEnvironmentResponse in its response field.
163
+ # @param [String] name
164
+ # Name of the resource that should be started, for example `users/me/
165
+ # environments/default` or `users/someone@example.com/environments/default`.
166
+ # @param [Google::Apis::CloudshellV1alpha1::StartEnvironmentRequest] start_environment_request_object
167
+ # @param [String] fields
168
+ # Selector specifying which fields to include in a partial response.
169
+ # @param [String] quota_user
170
+ # Available to use for quota purposes for server-side applications. Can be any
171
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
172
+ # @param [Google::Apis::RequestOptions] options
173
+ # Request-specific options
174
+ #
175
+ # @yield [result, err] Result & error if block supplied
176
+ # @yieldparam result [Google::Apis::CloudshellV1alpha1::Operation] parsed result object
177
+ # @yieldparam err [StandardError] error object if request failed
178
+ #
179
+ # @return [Google::Apis::CloudshellV1alpha1::Operation]
180
+ #
181
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
182
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
183
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
184
+ def start_environment(name, start_environment_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
185
+ command = make_simple_command(:post, 'v1alpha1/{+name}:start', options)
186
+ command.request_representation = Google::Apis::CloudshellV1alpha1::StartEnvironmentRequest::Representation
187
+ command.request_object = start_environment_request_object
188
+ command.response_representation = Google::Apis::CloudshellV1alpha1::Operation::Representation
189
+ command.response_class = Google::Apis::CloudshellV1alpha1::Operation
190
+ command.params['name'] = name unless name.nil?
191
+ command.query['fields'] = fields unless fields.nil?
192
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
193
+ execute_or_queue_command(command, &block)
194
+ end
195
+
196
+ # Adds a public SSH key to an environment, allowing clients with the
197
+ # corresponding private key to connect to that environment via SSH. If a key
198
+ # with the same format and content already exists, this will return the existing
199
+ # key.
200
+ # @param [String] parent
201
+ # Parent resource name, e.g. `users/me/environments/default`.
202
+ # @param [Google::Apis::CloudshellV1alpha1::CreatePublicKeyRequest] create_public_key_request_object
203
+ # @param [String] fields
204
+ # Selector specifying which fields to include in a partial response.
205
+ # @param [String] quota_user
206
+ # Available to use for quota purposes for server-side applications. Can be any
207
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
208
+ # @param [Google::Apis::RequestOptions] options
209
+ # Request-specific options
210
+ #
211
+ # @yield [result, err] Result & error if block supplied
212
+ # @yieldparam result [Google::Apis::CloudshellV1alpha1::PublicKey] parsed result object
213
+ # @yieldparam err [StandardError] error object if request failed
214
+ #
215
+ # @return [Google::Apis::CloudshellV1alpha1::PublicKey]
216
+ #
217
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
218
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
219
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
220
+ def create_public_key(parent, create_public_key_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
221
+ command = make_simple_command(:post, 'v1alpha1/{+parent}/publicKeys', options)
222
+ command.request_representation = Google::Apis::CloudshellV1alpha1::CreatePublicKeyRequest::Representation
223
+ command.request_object = create_public_key_request_object
224
+ command.response_representation = Google::Apis::CloudshellV1alpha1::PublicKey::Representation
225
+ command.response_class = Google::Apis::CloudshellV1alpha1::PublicKey
226
+ command.params['parent'] = parent unless parent.nil?
227
+ command.query['fields'] = fields unless fields.nil?
228
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
229
+ execute_or_queue_command(command, &block)
230
+ end
231
+
232
+ # Removes a public SSH key from an environment. Clients will no longer be able
233
+ # to connect to the environment using the corresponding private key.
234
+ # @param [String] name
235
+ # Name of the resource to be deleted, e.g. `users/me/environments/default/
236
+ # publicKeys/my-key`.
237
+ # @param [String] fields
238
+ # Selector specifying which fields to include in a partial response.
239
+ # @param [String] quota_user
240
+ # Available to use for quota purposes for server-side applications. Can be any
241
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
242
+ # @param [Google::Apis::RequestOptions] options
243
+ # Request-specific options
244
+ #
245
+ # @yield [result, err] Result & error if block supplied
246
+ # @yieldparam result [Google::Apis::CloudshellV1alpha1::Empty] parsed result object
247
+ # @yieldparam err [StandardError] error object if request failed
248
+ #
249
+ # @return [Google::Apis::CloudshellV1alpha1::Empty]
250
+ #
251
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
252
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
253
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
254
+ def delete_user_environment_public_key(name, fields: nil, quota_user: nil, options: nil, &block)
255
+ command = make_simple_command(:delete, 'v1alpha1/{+name}', options)
256
+ command.response_representation = Google::Apis::CloudshellV1alpha1::Empty::Representation
257
+ command.response_class = Google::Apis::CloudshellV1alpha1::Empty
258
+ command.params['name'] = name unless name.nil?
259
+ command.query['fields'] = fields unless fields.nil?
260
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
261
+ execute_or_queue_command(command, &block)
262
+ end
263
+
264
+ protected
265
+
266
+ def apply_command_defaults(command)
267
+ command.query['key'] = key unless key.nil?
268
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
269
+ end
270
+ end
271
+ end
272
+ end
273
+ end