azure_mgmt_server_management 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,10 +36,6 @@ module Azure::ARM::ServerManagement
36
36
  # is generated and included in each request. Default is true.
37
37
  attr_accessor :generate_client_request_id
38
38
 
39
- # @return Subscription credentials which uniquely identify client
40
- # subscription.
41
- attr_accessor :credentials
42
-
43
39
  # @return [Gateway] gateway
44
40
  attr_reader :gateway
45
41
 
@@ -76,5 +72,60 @@ module Azure::ARM::ServerManagement
76
72
  @generate_client_request_id = true
77
73
  end
78
74
 
75
+ #
76
+ # Makes a request and returns the body of the response.
77
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
78
+ # @param path [String] the path, relative to {base_url}.
79
+ # @param options [Hash{String=>String}] specifying any request options like :body.
80
+ # @return [Hash{String=>String}] containing the body of the response.
81
+ # Example:
82
+ #
83
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
84
+ # path = "/path"
85
+ # options = {
86
+ # body: request_content,
87
+ # query_params: {'api-version' => '2016-02-01'}
88
+ # }
89
+ # result = @client.make_request(:put, path, options)
90
+ #
91
+ def make_request(method, path, options = {})
92
+ result = make_request_with_http_info(method, path, options)
93
+ result.body unless result.nil?
94
+ end
95
+
96
+ #
97
+ # Makes a request and returns the operation response.
98
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
99
+ # @param path [String] the path, relative to {base_url}.
100
+ # @param options [Hash{String=>String}] specifying any request options like :body.
101
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
102
+ #
103
+ def make_request_with_http_info(method, path, options = {})
104
+ result = make_request_async(method, path, options).value!
105
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
106
+ result
107
+ end
108
+
109
+ #
110
+ # Makes a request asynchronously.
111
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
112
+ # @param path [String] the path, relative to {base_url}.
113
+ # @param options [Hash{String=>String}] specifying any request options like :body.
114
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
115
+ #
116
+ def make_request_async(method, path, options = {})
117
+ fail ArgumentError, 'method is nil' if method.nil?
118
+ fail ArgumentError, 'path is nil' if path.nil?
119
+
120
+ request_url = options[:base_url] || @base_url
121
+
122
+ request_headers = @request_headers
123
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
124
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
125
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
126
+
127
+ super(request_url, method, path, options)
128
+ end
129
+
79
130
  end
80
131
  end
@@ -150,31 +150,28 @@ module Azure::ARM::ServerManagement
150
150
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
151
151
 
152
152
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}'
153
+
154
+ request_url = @base_url || @client.base_url
155
+
153
156
  options = {
154
157
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
155
158
  path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session},
156
159
  query_params: {'api-version' => @client.api_version},
157
160
  body: request_content,
158
- headers: request_headers.merge(custom_headers || {})
161
+ headers: request_headers.merge(custom_headers || {}),
162
+ base_url: request_url
159
163
  }
164
+ promise = @client.make_request_async(:put, path_template, options)
160
165
 
161
- request_url = @base_url || @client.base_url
162
-
163
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
164
- promise = request.run_promise do |req|
165
- @client.credentials.sign_request(req) unless @client.credentials.nil?
166
- end
167
-
168
- promise = promise.then do |http_response|
166
+ promise = promise.then do |result|
167
+ http_response = result.response
169
168
  status_code = http_response.status
170
169
  response_content = http_response.body
171
170
  unless status_code == 200 || status_code == 201 || status_code == 202
172
171
  error_model = JSON.load(response_content)
173
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
172
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
174
173
  end
175
174
 
176
- # Create Result
177
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
178
175
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
179
176
  # Deserialize Response
180
177
  if status_code == 200
@@ -261,30 +258,27 @@ module Azure::ARM::ServerManagement
261
258
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
262
259
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
263
260
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}'
261
+
262
+ request_url = @base_url || @client.base_url
263
+
264
264
  options = {
265
265
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
266
266
  path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session},
267
267
  query_params: {'api-version' => @client.api_version},
268
- headers: request_headers.merge(custom_headers || {})
268
+ headers: request_headers.merge(custom_headers || {}),
269
+ base_url: request_url
269
270
  }
271
+ promise = @client.make_request_async(:delete, path_template, options)
270
272
 
271
- request_url = @base_url || @client.base_url
272
-
273
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
274
- promise = request.run_promise do |req|
275
- @client.credentials.sign_request(req) unless @client.credentials.nil?
276
- end
277
-
278
- promise = promise.then do |http_response|
273
+ promise = promise.then do |result|
274
+ http_response = result.response
279
275
  status_code = http_response.status
280
276
  response_content = http_response.body
281
277
  unless status_code == 200 || status_code == 204
282
278
  error_model = JSON.load(response_content)
283
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
279
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
284
280
  end
285
281
 
286
- # Create Result
287
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
288
282
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
289
283
 
290
284
  result
@@ -352,30 +346,27 @@ module Azure::ARM::ServerManagement
352
346
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
353
347
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
354
348
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}'
349
+
350
+ request_url = @base_url || @client.base_url
351
+
355
352
  options = {
356
353
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
357
354
  path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session},
358
355
  query_params: {'api-version' => @client.api_version},
359
- headers: request_headers.merge(custom_headers || {})
356
+ headers: request_headers.merge(custom_headers || {}),
357
+ base_url: request_url
360
358
  }
359
+ promise = @client.make_request_async(:get, path_template, options)
361
360
 
362
- request_url = @base_url || @client.base_url
363
-
364
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
365
- promise = request.run_promise do |req|
366
- @client.credentials.sign_request(req) unless @client.credentials.nil?
367
- end
368
-
369
- promise = promise.then do |http_response|
361
+ promise = promise.then do |result|
362
+ http_response = result.response
370
363
  status_code = http_response.status
371
364
  response_content = http_response.body
372
365
  unless status_code == 200
373
366
  error_model = JSON.load(response_content)
374
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
367
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
375
368
  end
376
369
 
377
- # Create Result
378
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
379
370
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
380
371
  # Deserialize Response
381
372
  if status_code == 200
@@ -4,5 +4,5 @@
4
4
  # regenerated.
5
5
 
6
6
  module Azure::ARM::ServerManagement
7
- VERSION = '0.6.0'
7
+ VERSION = '0.7.0'
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azure_mgmt_server_management
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-15 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.5.0
75
+ version: 0.6.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.5.0
82
+ version: 0.6.0
83
83
  description: Microsoft Azure Server Management Client Library for Ruby
84
84
  email: azrubyteam@microsoft.com
85
85
  executables: []
@@ -134,7 +134,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - ">="
136
136
  - !ruby/object:Gem::Version
137
- version: 1.9.3
137
+ version: 2.0.0
138
138
  required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - ">="