azure_mgmt_server_management 0.7.0 → 0.8.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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_server_management.rb +14 -11
  3. data/lib/generated/azure_mgmt_server_management/gateway.rb +444 -441
  4. data/lib/generated/azure_mgmt_server_management/models/{auto_upgrade.rb → credential_data_format.rb} +4 -5
  5. data/lib/generated/azure_mgmt_server_management/models/encryption_jwk_resource.rb +74 -0
  6. data/lib/generated/azure_mgmt_server_management/models/error.rb +2 -2
  7. data/lib/generated/azure_mgmt_server_management/models/gateway_expand_option.rb +2 -1
  8. data/lib/generated/azure_mgmt_server_management/models/gateway_parameters.rb +12 -11
  9. data/lib/generated/azure_mgmt_server_management/models/gateway_profile.rb +12 -12
  10. data/lib/generated/azure_mgmt_server_management/models/gateway_resource.rb +39 -15
  11. data/lib/generated/azure_mgmt_server_management/models/gateway_resources.rb +4 -4
  12. data/lib/generated/azure_mgmt_server_management/models/gateway_status.rb +108 -5
  13. data/lib/generated/azure_mgmt_server_management/models/node_parameters.rb +7 -7
  14. data/lib/generated/azure_mgmt_server_management/models/node_resource.rb +4 -4
  15. data/lib/generated/azure_mgmt_server_management/models/node_resources.rb +4 -4
  16. data/lib/generated/azure_mgmt_server_management/models/power_shell_command_parameters.rb +3 -3
  17. data/lib/generated/azure_mgmt_server_management/models/power_shell_command_result.rb +14 -14
  18. data/lib/generated/azure_mgmt_server_management/models/power_shell_command_results.rb +2 -2
  19. data/lib/generated/azure_mgmt_server_management/models/power_shell_command_status.rb +2 -2
  20. data/lib/generated/azure_mgmt_server_management/models/power_shell_expand_option.rb +1 -1
  21. data/lib/generated/azure_mgmt_server_management/models/power_shell_session_resource.rb +7 -7
  22. data/lib/generated/azure_mgmt_server_management/models/power_shell_session_resources.rb +5 -5
  23. data/lib/generated/azure_mgmt_server_management/models/power_shell_tab_completion_parameters.rb +2 -2
  24. data/lib/generated/azure_mgmt_server_management/models/power_shell_tab_completion_results.rb +3 -3
  25. data/lib/generated/azure_mgmt_server_management/models/prompt_field_description.rb +6 -6
  26. data/lib/generated/azure_mgmt_server_management/models/prompt_field_type.rb +1 -1
  27. data/lib/generated/azure_mgmt_server_management/models/prompt_message_response.rb +3 -3
  28. data/lib/generated/azure_mgmt_server_management/models/retention_period.rb +16 -0
  29. data/lib/generated/azure_mgmt_server_management/models/session_parameters.rb +38 -4
  30. data/lib/generated/azure_mgmt_server_management/models/session_resource.rb +4 -4
  31. data/lib/generated/azure_mgmt_server_management/models/upgrade_mode.rb +16 -0
  32. data/lib/generated/azure_mgmt_server_management/models/version.rb +8 -8
  33. data/lib/generated/azure_mgmt_server_management/module_definition.rb +1 -1
  34. data/lib/generated/azure_mgmt_server_management/node.rb +309 -309
  35. data/lib/generated/azure_mgmt_server_management/power_shell.rb +280 -280
  36. data/lib/generated/azure_mgmt_server_management/server_management.rb +16 -3
  37. data/lib/generated/azure_mgmt_server_management/session.rb +128 -95
  38. data/lib/generated/azure_mgmt_server_management/version.rb +2 -2
  39. metadata +8 -5
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -22,7 +22,7 @@ module Azure::ARM::ServerManagement
22
22
  # for every service call.
23
23
  attr_accessor :subscription_id
24
24
 
25
- # @return [String] Client Api Version.
25
+ # @return [String] Client API Version.
26
26
  attr_reader :api_version
27
27
 
28
28
  # @return [String] Gets or sets the preferred language for the response.
@@ -66,10 +66,11 @@ module Azure::ARM::ServerManagement
66
66
  @node = Node.new(self)
67
67
  @session = Session.new(self)
68
68
  @power_shell = PowerShell.new(self)
69
- @api_version = '2015-07-01-preview'
69
+ @api_version = '2016-07-01-preview'
70
70
  @accept_language = 'en-US'
71
71
  @long_running_operation_retry_timeout = 30
72
72
  @generate_client_request_id = true
73
+ add_telemetry
73
74
  end
74
75
 
75
76
  #
@@ -127,5 +128,17 @@ module Azure::ARM::ServerManagement
127
128
  super(request_url, method, path, options)
128
129
  end
129
130
 
131
+
132
+ private
133
+ #
134
+ # Adds telemetry information.
135
+ #
136
+ def add_telemetry
137
+ sdk_information = 'azure_mgmt_server_management'
138
+ if defined? Azure::ARM::ServerManagement::VERSION
139
+ sdk_information = "#{sdk_information}/#{Azure::ARM::ServerManagement::VERSION}"
140
+ end
141
+ add_user_agent_information(sdk_information)
142
+ end
130
143
  end
131
144
  end
@@ -1,11 +1,11 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
6
6
  module Azure::ARM::ServerManagement
7
7
  #
8
- # REST API for Azure Server Management Service
8
+ # REST API for Azure Server Management Service.
9
9
  #
10
10
  class Session
11
11
  include Azure::ARM::ServerManagement::Models
@@ -23,21 +23,27 @@ module Azure::ARM::ServerManagement
23
23
  attr_reader :client
24
24
 
25
25
  #
26
- # Creates a session for a node
26
+ # Creates a session for a node.
27
27
  #
28
28
  # @param resource_group_name [String] The resource group name uniquely
29
29
  # identifies the resource group within the user subscriptionId.
30
30
  # @param node_name [String] The node name (256 characters maximum).
31
- # @param session [String] The sessionId from the user
32
- # @param user_name [String] User name to be used to connect to node
33
- # @param password [String] Password associated with user name
31
+ # @param session [String] The sessionId from the user.
32
+ # @param user_name [String] Encrypted User name to be used to connect to node.
33
+ # @param password [String] Encrypted Password associated with user name.
34
+ # @param retention_period [RetentionPeriod] Session retention period. Possible
35
+ # values include: 'Session', 'Persistent'
36
+ # @param credential_data_format [CredentialDataFormat] Credential data format.
37
+ # Possible values include: 'RsaEncrypted'
38
+ # @param encryption_certificate_thumbprint [String] Encryption certificate
39
+ # thumbprint.
34
40
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
41
  # will be added to the HTTP request.
36
42
  #
37
43
  # @return [SessionResource] operation results.
38
44
  #
39
- def create(resource_group_name, node_name, session, user_name = nil, password = nil, custom_headers = nil)
40
- response = create_async(resource_group_name, node_name, session, user_name, password, custom_headers).value!
45
+ def create(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil)
46
+ response = create_async(resource_group_name, node_name, session, user_name, password, retention_period, credential_data_format, encryption_certificate_thumbprint, custom_headers).value!
41
47
  response.body unless response.nil?
42
48
  end
43
49
 
@@ -45,18 +51,24 @@ module Azure::ARM::ServerManagement
45
51
  # @param resource_group_name [String] The resource group name uniquely
46
52
  # identifies the resource group within the user subscriptionId.
47
53
  # @param node_name [String] The node name (256 characters maximum).
48
- # @param session [String] The sessionId from the user
49
- # @param user_name [String] User name to be used to connect to node
50
- # @param password [String] Password associated with user name
54
+ # @param session [String] The sessionId from the user.
55
+ # @param user_name [String] Encrypted User name to be used to connect to node.
56
+ # @param password [String] Encrypted Password associated with user name.
57
+ # @param retention_period [RetentionPeriod] Session retention period. Possible
58
+ # values include: 'Session', 'Persistent'
59
+ # @param credential_data_format [CredentialDataFormat] Credential data format.
60
+ # Possible values include: 'RsaEncrypted'
61
+ # @param encryption_certificate_thumbprint [String] Encryption certificate
62
+ # thumbprint.
51
63
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
52
64
  # will be added to the HTTP request.
53
65
  #
54
66
  # @return [Concurrent::Promise] promise which provides async access to http
55
67
  # response.
56
68
  #
57
- def create_async(resource_group_name, node_name, session, user_name = nil, password = nil, custom_headers = nil)
69
+ def create_async(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil)
58
70
  # Send request
59
- promise = begin_create_async(resource_group_name, node_name, session, user_name, password, custom_headers)
71
+ promise = begin_create_async(resource_group_name, node_name, session, user_name, password, retention_period, credential_data_format, encryption_certificate_thumbprint, custom_headers)
60
72
 
61
73
  promise = promise.then do |response|
62
74
  # Defining deserialization method.
@@ -73,82 +85,62 @@ module Azure::ARM::ServerManagement
73
85
  end
74
86
 
75
87
  #
76
- # Creates a session for a node
88
+ # Deletes a session for a node.
77
89
  #
78
90
  # @param resource_group_name [String] The resource group name uniquely
79
91
  # identifies the resource group within the user subscriptionId.
80
92
  # @param node_name [String] The node name (256 characters maximum).
81
- # @param session [String] The sessionId from the user
82
- # @param user_name [String] User name to be used to connect to node
83
- # @param password [String] Password associated with user name
93
+ # @param session [String] The sessionId from the user.
84
94
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
85
95
  # will be added to the HTTP request.
86
96
  #
87
- # @return [SessionResource] operation results.
88
97
  #
89
- def begin_create(resource_group_name, node_name, session, user_name = nil, password = nil, custom_headers = nil)
90
- response = begin_create_async(resource_group_name, node_name, session, user_name, password, custom_headers).value!
91
- response.body unless response.nil?
98
+ def delete(resource_group_name, node_name, session, custom_headers = nil)
99
+ response = delete_async(resource_group_name, node_name, session, custom_headers).value!
100
+ nil
92
101
  end
93
102
 
94
103
  #
95
- # Creates a session for a node
104
+ # Deletes a session for a node.
96
105
  #
97
106
  # @param resource_group_name [String] The resource group name uniquely
98
107
  # identifies the resource group within the user subscriptionId.
99
108
  # @param node_name [String] The node name (256 characters maximum).
100
- # @param session [String] The sessionId from the user
101
- # @param user_name [String] User name to be used to connect to node
102
- # @param password [String] Password associated with user name
109
+ # @param session [String] The sessionId from the user.
103
110
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
104
111
  # will be added to the HTTP request.
105
112
  #
106
113
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
107
114
  #
108
- def begin_create_with_http_info(resource_group_name, node_name, session, user_name = nil, password = nil, custom_headers = nil)
109
- begin_create_async(resource_group_name, node_name, session, user_name, password, custom_headers).value!
115
+ def delete_with_http_info(resource_group_name, node_name, session, custom_headers = nil)
116
+ delete_async(resource_group_name, node_name, session, custom_headers).value!
110
117
  end
111
118
 
112
119
  #
113
- # Creates a session for a node
120
+ # Deletes a session for a node.
114
121
  #
115
122
  # @param resource_group_name [String] The resource group name uniquely
116
123
  # identifies the resource group within the user subscriptionId.
117
124
  # @param node_name [String] The node name (256 characters maximum).
118
- # @param session [String] The sessionId from the user
119
- # @param user_name [String] User name to be used to connect to node
120
- # @param password [String] Password associated with user name
125
+ # @param session [String] The sessionId from the user.
121
126
  # @param [Hash{String => String}] A hash of custom headers that will be added
122
127
  # to the HTTP request.
123
128
  #
124
129
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
125
130
  #
126
- def begin_create_async(resource_group_name, node_name, session, user_name = nil, password = nil, custom_headers = nil)
131
+ def delete_async(resource_group_name, node_name, session, custom_headers = nil)
127
132
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
128
133
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
129
134
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
130
135
  fail ArgumentError, 'node_name is nil' if node_name.nil?
131
136
  fail ArgumentError, 'session is nil' if session.nil?
132
137
 
133
- session_parameters = SessionParameters.new
134
- unless user_name.nil? && password.nil?
135
- session_parameters.user_name = user_name
136
- session_parameters.password = password
137
- end
138
138
 
139
139
  request_headers = {}
140
140
 
141
141
  # Set Headers
142
142
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
143
143
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
144
-
145
- request_headers['Content-Type'] = 'application/json; charset=utf-8'
146
-
147
- # Serialize Request
148
- request_mapper = SessionParameters.mapper()
149
- request_content = @client.serialize(request_mapper, session_parameters, 'session_parameters')
150
- request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
151
-
152
144
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}'
153
145
 
154
146
  request_url = @base_url || @client.base_url
@@ -157,42 +149,21 @@ module Azure::ARM::ServerManagement
157
149
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
158
150
  path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session},
159
151
  query_params: {'api-version' => @client.api_version},
160
- body: request_content,
161
152
  headers: request_headers.merge(custom_headers || {}),
162
153
  base_url: request_url
163
154
  }
164
- promise = @client.make_request_async(:put, path_template, options)
155
+ promise = @client.make_request_async(:delete, path_template, options)
165
156
 
166
157
  promise = promise.then do |result|
167
158
  http_response = result.response
168
159
  status_code = http_response.status
169
160
  response_content = http_response.body
170
- unless status_code == 200 || status_code == 201 || status_code == 202
161
+ unless status_code == 200 || status_code == 204
171
162
  error_model = JSON.load(response_content)
172
163
  fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
173
164
  end
174
165
 
175
166
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
176
- # Deserialize Response
177
- if status_code == 200
178
- begin
179
- parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
180
- result_mapper = SessionResource.mapper()
181
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
182
- rescue Exception => e
183
- fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
184
- end
185
- end
186
- # Deserialize Response
187
- if status_code == 201
188
- begin
189
- parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
190
- result_mapper = SessionResource.mapper()
191
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
192
- rescue Exception => e
193
- fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
194
- end
195
- end
196
167
 
197
168
  result
198
169
  end
@@ -201,50 +172,51 @@ module Azure::ARM::ServerManagement
201
172
  end
202
173
 
203
174
  #
204
- # Deletes a session for a node
175
+ # Gets a session for a node.
205
176
  #
206
177
  # @param resource_group_name [String] The resource group name uniquely
207
178
  # identifies the resource group within the user subscriptionId.
208
179
  # @param node_name [String] The node name (256 characters maximum).
209
- # @param session [String] The sessionId from the user
180
+ # @param session [String] The sessionId from the user.
210
181
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
211
182
  # will be added to the HTTP request.
212
183
  #
184
+ # @return [SessionResource] operation results.
213
185
  #
214
- def delete(resource_group_name, node_name, session, custom_headers = nil)
215
- response = delete_async(resource_group_name, node_name, session, custom_headers).value!
216
- nil
186
+ def get(resource_group_name, node_name, session, custom_headers = nil)
187
+ response = get_async(resource_group_name, node_name, session, custom_headers).value!
188
+ response.body unless response.nil?
217
189
  end
218
190
 
219
191
  #
220
- # Deletes a session for a node
192
+ # Gets a session for a node.
221
193
  #
222
194
  # @param resource_group_name [String] The resource group name uniquely
223
195
  # identifies the resource group within the user subscriptionId.
224
196
  # @param node_name [String] The node name (256 characters maximum).
225
- # @param session [String] The sessionId from the user
197
+ # @param session [String] The sessionId from the user.
226
198
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
227
199
  # will be added to the HTTP request.
228
200
  #
229
201
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
230
202
  #
231
- def delete_with_http_info(resource_group_name, node_name, session, custom_headers = nil)
232
- delete_async(resource_group_name, node_name, session, custom_headers).value!
203
+ def get_with_http_info(resource_group_name, node_name, session, custom_headers = nil)
204
+ get_async(resource_group_name, node_name, session, custom_headers).value!
233
205
  end
234
206
 
235
207
  #
236
- # Deletes a session for a node
208
+ # Gets a session for a node.
237
209
  #
238
210
  # @param resource_group_name [String] The resource group name uniquely
239
211
  # identifies the resource group within the user subscriptionId.
240
212
  # @param node_name [String] The node name (256 characters maximum).
241
- # @param session [String] The sessionId from the user
213
+ # @param session [String] The sessionId from the user.
242
214
  # @param [Hash{String => String}] A hash of custom headers that will be added
243
215
  # to the HTTP request.
244
216
  #
245
217
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
246
218
  #
247
- def delete_async(resource_group_name, node_name, session, custom_headers = nil)
219
+ def get_async(resource_group_name, node_name, session, custom_headers = nil)
248
220
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
249
221
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
250
222
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
@@ -268,18 +240,28 @@ module Azure::ARM::ServerManagement
268
240
  headers: request_headers.merge(custom_headers || {}),
269
241
  base_url: request_url
270
242
  }
271
- promise = @client.make_request_async(:delete, path_template, options)
243
+ promise = @client.make_request_async(:get, path_template, options)
272
244
 
273
245
  promise = promise.then do |result|
274
246
  http_response = result.response
275
247
  status_code = http_response.status
276
248
  response_content = http_response.body
277
- unless status_code == 200 || status_code == 204
249
+ unless status_code == 200
278
250
  error_model = JSON.load(response_content)
279
251
  fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
280
252
  end
281
253
 
282
254
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
255
+ # Deserialize Response
256
+ if status_code == 200
257
+ begin
258
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
259
+ result_mapper = SessionResource.mapper()
260
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
261
+ rescue Exception => e
262
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
263
+ end
264
+ end
283
265
 
284
266
  result
285
267
  end
@@ -288,63 +270,103 @@ module Azure::ARM::ServerManagement
288
270
  end
289
271
 
290
272
  #
291
- # Gets a session for a node
273
+ # Creates a session for a node.
292
274
  #
293
275
  # @param resource_group_name [String] The resource group name uniquely
294
276
  # identifies the resource group within the user subscriptionId.
295
277
  # @param node_name [String] The node name (256 characters maximum).
296
- # @param session [String] The sessionId from the user
278
+ # @param session [String] The sessionId from the user.
279
+ # @param user_name [String] Encrypted User name to be used to connect to node.
280
+ # @param password [String] Encrypted Password associated with user name.
281
+ # @param retention_period [RetentionPeriod] Session retention period. Possible
282
+ # values include: 'Session', 'Persistent'
283
+ # @param credential_data_format [CredentialDataFormat] Credential data format.
284
+ # Possible values include: 'RsaEncrypted'
285
+ # @param encryption_certificate_thumbprint [String] Encryption certificate
286
+ # thumbprint.
297
287
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
298
288
  # will be added to the HTTP request.
299
289
  #
300
290
  # @return [SessionResource] operation results.
301
291
  #
302
- def get(resource_group_name, node_name, session, custom_headers = nil)
303
- response = get_async(resource_group_name, node_name, session, custom_headers).value!
292
+ def begin_create(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil)
293
+ response = begin_create_async(resource_group_name, node_name, session, user_name, password, retention_period, credential_data_format, encryption_certificate_thumbprint, custom_headers).value!
304
294
  response.body unless response.nil?
305
295
  end
306
296
 
307
297
  #
308
- # Gets a session for a node
298
+ # Creates a session for a node.
309
299
  #
310
300
  # @param resource_group_name [String] The resource group name uniquely
311
301
  # identifies the resource group within the user subscriptionId.
312
302
  # @param node_name [String] The node name (256 characters maximum).
313
- # @param session [String] The sessionId from the user
303
+ # @param session [String] The sessionId from the user.
304
+ # @param user_name [String] Encrypted User name to be used to connect to node.
305
+ # @param password [String] Encrypted Password associated with user name.
306
+ # @param retention_period [RetentionPeriod] Session retention period. Possible
307
+ # values include: 'Session', 'Persistent'
308
+ # @param credential_data_format [CredentialDataFormat] Credential data format.
309
+ # Possible values include: 'RsaEncrypted'
310
+ # @param encryption_certificate_thumbprint [String] Encryption certificate
311
+ # thumbprint.
314
312
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
315
313
  # will be added to the HTTP request.
316
314
  #
317
315
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
318
316
  #
319
- def get_with_http_info(resource_group_name, node_name, session, custom_headers = nil)
320
- get_async(resource_group_name, node_name, session, custom_headers).value!
317
+ def begin_create_with_http_info(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil)
318
+ begin_create_async(resource_group_name, node_name, session, user_name, password, retention_period, credential_data_format, encryption_certificate_thumbprint, custom_headers).value!
321
319
  end
322
320
 
323
321
  #
324
- # Gets a session for a node
322
+ # Creates a session for a node.
325
323
  #
326
324
  # @param resource_group_name [String] The resource group name uniquely
327
325
  # identifies the resource group within the user subscriptionId.
328
326
  # @param node_name [String] The node name (256 characters maximum).
329
- # @param session [String] The sessionId from the user
327
+ # @param session [String] The sessionId from the user.
328
+ # @param user_name [String] Encrypted User name to be used to connect to node.
329
+ # @param password [String] Encrypted Password associated with user name.
330
+ # @param retention_period [RetentionPeriod] Session retention period. Possible
331
+ # values include: 'Session', 'Persistent'
332
+ # @param credential_data_format [CredentialDataFormat] Credential data format.
333
+ # Possible values include: 'RsaEncrypted'
334
+ # @param encryption_certificate_thumbprint [String] Encryption certificate
335
+ # thumbprint.
330
336
  # @param [Hash{String => String}] A hash of custom headers that will be added
331
337
  # to the HTTP request.
332
338
  #
333
339
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
334
340
  #
335
- def get_async(resource_group_name, node_name, session, custom_headers = nil)
341
+ def begin_create_async(resource_group_name, node_name, session, user_name = nil, password = nil, retention_period = nil, credential_data_format = nil, encryption_certificate_thumbprint = nil, custom_headers = nil)
336
342
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
337
343
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
338
344
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
339
345
  fail ArgumentError, 'node_name is nil' if node_name.nil?
340
346
  fail ArgumentError, 'session is nil' if session.nil?
341
347
 
348
+ session_parameters = SessionParameters.new
349
+ unless user_name.nil? && password.nil? && retention_period.nil? && credential_data_format.nil? && encryption_certificate_thumbprint.nil?
350
+ session_parameters.user_name = user_name
351
+ session_parameters.password = password
352
+ session_parameters.retention_period = retention_period
353
+ session_parameters.credential_data_format = credential_data_format
354
+ session_parameters.encryption_certificate_thumbprint = encryption_certificate_thumbprint
355
+ end
342
356
 
343
357
  request_headers = {}
344
358
 
345
359
  # Set Headers
346
360
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
347
361
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
362
+
363
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
364
+
365
+ # Serialize Request
366
+ request_mapper = SessionParameters.mapper()
367
+ request_content = @client.serialize(request_mapper, session_parameters, 'session_parameters')
368
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
369
+
348
370
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}'
349
371
 
350
372
  request_url = @base_url || @client.base_url
@@ -353,16 +375,17 @@ module Azure::ARM::ServerManagement
353
375
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
354
376
  path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session},
355
377
  query_params: {'api-version' => @client.api_version},
378
+ body: request_content,
356
379
  headers: request_headers.merge(custom_headers || {}),
357
380
  base_url: request_url
358
381
  }
359
- promise = @client.make_request_async(:get, path_template, options)
382
+ promise = @client.make_request_async(:put, path_template, options)
360
383
 
361
384
  promise = promise.then do |result|
362
385
  http_response = result.response
363
386
  status_code = http_response.status
364
387
  response_content = http_response.body
365
- unless status_code == 200
388
+ unless status_code == 200 || status_code == 201 || status_code == 202
366
389
  error_model = JSON.load(response_content)
367
390
  fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
368
391
  end
@@ -378,6 +401,16 @@ module Azure::ARM::ServerManagement
378
401
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
379
402
  end
380
403
  end
404
+ # Deserialize Response
405
+ if status_code == 201
406
+ begin
407
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
408
+ result_mapper = SessionResource.mapper()
409
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
410
+ rescue Exception => e
411
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
412
+ end
413
+ end
381
414
 
382
415
  result
383
416
  end