azure_mgmt_graph 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21b3712c92b863699dbd2f0de01f87d001670c07
4
- data.tar.gz: 6fd997ce917e84194e7ef244e371b32b8330d3af
3
+ metadata.gz: b1593fb44c7666855f4a7265ff59dcece4429019
4
+ data.tar.gz: 7944fd38554d7df4bb04295fdaea5218fbbf8662
5
5
  SHA512:
6
- metadata.gz: daba77c4f76efcdd635e7699ab2b07158523b6eb99c4e91ae9b5b5a485644894eb80faaac66a51bccbae1c15e3ea26b87ecaf0a642f45143969989388e34cf6b
7
- data.tar.gz: 08b133efca08e3a43a3ed3ad48c6f3ca75e90e5148f052a061fcb5731cb90be56ac376efd8d4637c9d30aac65004f6773d2d42c97f3152a54a6e6a51cdde4ec6
6
+ metadata.gz: 5a7c928a08cc5a80ae7bb79f77efe7df69cf2fa783a306327fdcb581b7d070f43c07dca594ee51a76c7b18d7c9f31254ff985f0a54c380f7fa959ae93b1a713d
7
+ data.tar.gz: 43678cad45497efa7d574c2f50c479b5e7d75f25374f727f671a9412e021c4f2bd52401c8d599fa59dd28fd142c5590e694db9d4daa6e3dcc90cce7c5bd7099c
@@ -84,31 +84,28 @@ module Azure::ARM::Graph
84
84
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
85
85
 
86
86
  path_template = '/{tenantID}/applications'
87
+
88
+ request_url = @base_url || @client.base_url
89
+
87
90
  options = {
88
91
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
89
92
  path_params: {'tenantID' => @client.tenant_id},
90
93
  query_params: {'api-version' => api_version},
91
94
  body: request_content,
92
- headers: request_headers.merge(custom_headers || {})
95
+ headers: request_headers.merge(custom_headers || {}),
96
+ base_url: request_url
93
97
  }
98
+ promise = @client.make_request_async(:post, path_template, options)
94
99
 
95
- request_url = @base_url || @client.base_url
96
-
97
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
98
- promise = request.run_promise do |req|
99
- @client.credentials.sign_request(req) unless @client.credentials.nil?
100
- end
101
-
102
- promise = promise.then do |http_response|
100
+ promise = promise.then do |result|
101
+ http_response = result.response
103
102
  status_code = http_response.status
104
103
  response_content = http_response.body
105
104
  unless status_code == 201
106
105
  error_model = JSON.load(response_content)
107
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
106
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
108
107
  end
109
108
 
110
- # Create Result
111
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
112
109
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
113
110
  # Deserialize Response
114
111
  if status_code == 201
@@ -135,11 +132,33 @@ module Azure::ARM::Graph
135
132
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
136
133
  # will be added to the HTTP request.
137
134
  #
138
- # @return [ApplicationListResult] operation results.
135
+ # @return [ApplicationListResult] which provide lazy access to pages of the
136
+ # response.
139
137
  #
140
- def list(filter = nil, custom_headers = nil)
138
+ def list_as_lazy(filter = nil, custom_headers = nil)
141
139
  response = list_async(filter, custom_headers).value!
142
- response.body unless response.nil?
140
+ unless response.nil?
141
+ page = response.body
142
+ page.next_method = Proc.new do |next_link|
143
+ list_next_async(next_link, custom_headers)
144
+ end
145
+ page
146
+ end
147
+ end
148
+
149
+ #
150
+ # Lists applications by filter parameters. Reference:
151
+ # http://msdn.microsoft.com/en-us/library/azure/hh974476.aspx
152
+ #
153
+ # @param filter [String] The filters to apply on the operation
154
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
155
+ # will be added to the HTTP request.
156
+ #
157
+ # @return [Array<Application>] operation results.
158
+ #
159
+ def list(filter = nil, custom_headers = nil)
160
+ first_page = list_as_lazy(filter, custom_headers)
161
+ first_page.get_all_items
143
162
  end
144
163
 
145
164
  #
@@ -177,30 +196,27 @@ module Azure::ARM::Graph
177
196
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
178
197
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
179
198
  path_template = '/{tenantID}/applications'
199
+
200
+ request_url = @base_url || @client.base_url
201
+
180
202
  options = {
181
203
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
182
204
  path_params: {'tenantID' => @client.tenant_id},
183
205
  query_params: {'$filter' => filter,'api-version' => api_version},
184
- headers: request_headers.merge(custom_headers || {})
206
+ headers: request_headers.merge(custom_headers || {}),
207
+ base_url: request_url
185
208
  }
209
+ promise = @client.make_request_async(:get, path_template, options)
186
210
 
187
- request_url = @base_url || @client.base_url
188
-
189
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
190
- promise = request.run_promise do |req|
191
- @client.credentials.sign_request(req) unless @client.credentials.nil?
192
- end
193
-
194
- promise = promise.then do |http_response|
211
+ promise = promise.then do |result|
212
+ http_response = result.response
195
213
  status_code = http_response.status
196
214
  response_content = http_response.body
197
215
  unless status_code == 200
198
216
  error_model = JSON.load(response_content)
199
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
217
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
200
218
  end
201
219
 
202
- # Create Result
203
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
204
220
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
205
221
  # Deserialize Response
206
222
  if status_code == 200
@@ -269,31 +285,28 @@ module Azure::ARM::Graph
269
285
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
270
286
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
271
287
  path_template = '/{tenantID}/applications/{applicationObjectId}'
288
+
289
+ request_url = @base_url || @client.base_url
290
+
272
291
  options = {
273
292
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
274
293
  path_params: {'tenantID' => @client.tenant_id},
275
294
  skip_encoding_path_params: {'applicationObjectId' => application_object_id},
276
295
  query_params: {'api-version' => api_version},
277
- headers: request_headers.merge(custom_headers || {})
296
+ headers: request_headers.merge(custom_headers || {}),
297
+ base_url: request_url
278
298
  }
299
+ promise = @client.make_request_async(:delete, path_template, options)
279
300
 
280
- request_url = @base_url || @client.base_url
281
-
282
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
283
- promise = request.run_promise do |req|
284
- @client.credentials.sign_request(req) unless @client.credentials.nil?
285
- end
286
-
287
- promise = promise.then do |http_response|
301
+ promise = promise.then do |result|
302
+ http_response = result.response
288
303
  status_code = http_response.status
289
304
  response_content = http_response.body
290
305
  unless status_code == 204
291
306
  error_model = JSON.load(response_content)
292
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
307
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
293
308
  end
294
309
 
295
- # Create Result
296
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
297
310
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
298
311
 
299
312
  result
@@ -353,31 +366,28 @@ module Azure::ARM::Graph
353
366
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
354
367
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
355
368
  path_template = '/{tenantID}/applications/{applicationObjectId}'
369
+
370
+ request_url = @base_url || @client.base_url
371
+
356
372
  options = {
357
373
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
358
374
  path_params: {'tenantID' => @client.tenant_id},
359
375
  skip_encoding_path_params: {'applicationObjectId' => application_object_id},
360
376
  query_params: {'api-version' => api_version},
361
- headers: request_headers.merge(custom_headers || {})
377
+ headers: request_headers.merge(custom_headers || {}),
378
+ base_url: request_url
362
379
  }
380
+ promise = @client.make_request_async(:get, path_template, options)
363
381
 
364
- request_url = @base_url || @client.base_url
365
-
366
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
367
- promise = request.run_promise do |req|
368
- @client.credentials.sign_request(req) unless @client.credentials.nil?
369
- end
370
-
371
- promise = promise.then do |http_response|
382
+ promise = promise.then do |result|
383
+ http_response = result.response
372
384
  status_code = http_response.status
373
385
  response_content = http_response.body
374
386
  unless status_code == 200
375
387
  error_model = JSON.load(response_content)
376
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
388
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
377
389
  end
378
390
 
379
- # Create Result
380
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
381
391
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
382
392
  # Deserialize Response
383
393
  if status_code == 200
@@ -461,32 +471,29 @@ module Azure::ARM::Graph
461
471
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
462
472
 
463
473
  path_template = '/{tenantID}/applications/{applicationObjectId}'
474
+
475
+ request_url = @base_url || @client.base_url
476
+
464
477
  options = {
465
478
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
466
479
  path_params: {'tenantID' => @client.tenant_id},
467
480
  skip_encoding_path_params: {'applicationObjectId' => application_object_id},
468
481
  query_params: {'api-version' => api_version},
469
482
  body: request_content,
470
- headers: request_headers.merge(custom_headers || {})
483
+ headers: request_headers.merge(custom_headers || {}),
484
+ base_url: request_url
471
485
  }
486
+ promise = @client.make_request_async(:patch, path_template, options)
472
487
 
473
- request_url = @base_url || @client.base_url
474
-
475
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
476
- promise = request.run_promise do |req|
477
- @client.credentials.sign_request(req) unless @client.credentials.nil?
478
- end
479
-
480
- promise = promise.then do |http_response|
488
+ promise = promise.then do |result|
489
+ http_response = result.response
481
490
  status_code = http_response.status
482
491
  response_content = http_response.body
483
492
  unless status_code == 204
484
493
  error_model = JSON.load(response_content)
485
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
494
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
486
495
  end
487
496
 
488
- # Create Result
489
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
490
497
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
491
498
 
492
499
  result
@@ -546,31 +553,28 @@ module Azure::ARM::Graph
546
553
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
547
554
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
548
555
  path_template = '/{tenantID}/applications/{applicationObjectId}/keyCredentials'
556
+
557
+ request_url = @base_url || @client.base_url
558
+
549
559
  options = {
550
560
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
551
561
  path_params: {'tenantID' => @client.tenant_id},
552
562
  skip_encoding_path_params: {'applicationObjectId' => application_object_id},
553
563
  query_params: {'api-version' => api_version},
554
- headers: request_headers.merge(custom_headers || {})
564
+ headers: request_headers.merge(custom_headers || {}),
565
+ base_url: request_url
555
566
  }
567
+ promise = @client.make_request_async(:get, path_template, options)
556
568
 
557
- request_url = @base_url || @client.base_url
558
-
559
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
560
- promise = request.run_promise do |req|
561
- @client.credentials.sign_request(req) unless @client.credentials.nil?
562
- end
563
-
564
- promise = promise.then do |http_response|
569
+ promise = promise.then do |result|
570
+ http_response = result.response
565
571
  status_code = http_response.status
566
572
  response_content = http_response.body
567
573
  unless status_code == 200
568
574
  error_model = JSON.load(response_content)
569
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
575
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
570
576
  end
571
577
 
572
- # Create Result
573
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
574
578
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
575
579
  # Deserialize Response
576
580
  if status_code == 200
@@ -654,32 +658,29 @@ module Azure::ARM::Graph
654
658
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
655
659
 
656
660
  path_template = '/{tenantID}/applications/{applicationObjectId}/keyCredentials'
661
+
662
+ request_url = @base_url || @client.base_url
663
+
657
664
  options = {
658
665
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
659
666
  path_params: {'tenantID' => @client.tenant_id},
660
667
  skip_encoding_path_params: {'applicationObjectId' => application_object_id},
661
668
  query_params: {'api-version' => api_version},
662
669
  body: request_content,
663
- headers: request_headers.merge(custom_headers || {})
670
+ headers: request_headers.merge(custom_headers || {}),
671
+ base_url: request_url
664
672
  }
673
+ promise = @client.make_request_async(:patch, path_template, options)
665
674
 
666
- request_url = @base_url || @client.base_url
667
-
668
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
669
- promise = request.run_promise do |req|
670
- @client.credentials.sign_request(req) unless @client.credentials.nil?
671
- end
672
-
673
- promise = promise.then do |http_response|
675
+ promise = promise.then do |result|
676
+ http_response = result.response
674
677
  status_code = http_response.status
675
678
  response_content = http_response.body
676
679
  unless status_code == 204
677
680
  error_model = JSON.load(response_content)
678
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
681
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
679
682
  end
680
683
 
681
- # Create Result
682
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
683
684
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
684
685
 
685
686
  result
@@ -739,31 +740,28 @@ module Azure::ARM::Graph
739
740
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
740
741
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
741
742
  path_template = '/{tenantID}/applications/{applicationObjectId}/passwordCredentials'
743
+
744
+ request_url = @base_url || @client.base_url
745
+
742
746
  options = {
743
747
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
744
748
  path_params: {'tenantID' => @client.tenant_id},
745
749
  skip_encoding_path_params: {'applicationObjectId' => application_object_id},
746
750
  query_params: {'api-version' => api_version},
747
- headers: request_headers.merge(custom_headers || {})
751
+ headers: request_headers.merge(custom_headers || {}),
752
+ base_url: request_url
748
753
  }
754
+ promise = @client.make_request_async(:get, path_template, options)
749
755
 
750
- request_url = @base_url || @client.base_url
751
-
752
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
753
- promise = request.run_promise do |req|
754
- @client.credentials.sign_request(req) unless @client.credentials.nil?
755
- end
756
-
757
- promise = promise.then do |http_response|
756
+ promise = promise.then do |result|
757
+ http_response = result.response
758
758
  status_code = http_response.status
759
759
  response_content = http_response.body
760
760
  unless status_code == 200
761
761
  error_model = JSON.load(response_content)
762
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
762
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
763
763
  end
764
764
 
765
- # Create Result
766
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
767
765
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
768
766
  # Deserialize Response
769
767
  if status_code == 200
@@ -850,33 +848,118 @@ module Azure::ARM::Graph
850
848
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
851
849
 
852
850
  path_template = '/{tenantID}/applications/{applicationObjectId}/passwordCredentials'
851
+
852
+ request_url = @base_url || @client.base_url
853
+
853
854
  options = {
854
855
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
855
856
  path_params: {'tenantID' => @client.tenant_id},
856
857
  skip_encoding_path_params: {'applicationObjectId' => application_object_id},
857
858
  query_params: {'api-version' => api_version},
858
859
  body: request_content,
859
- headers: request_headers.merge(custom_headers || {})
860
+ headers: request_headers.merge(custom_headers || {}),
861
+ base_url: request_url
860
862
  }
863
+ promise = @client.make_request_async(:patch, path_template, options)
861
864
 
862
- request_url = @base_url || @client.base_url
865
+ promise = promise.then do |result|
866
+ http_response = result.response
867
+ status_code = http_response.status
868
+ response_content = http_response.body
869
+ unless status_code == 204
870
+ error_model = JSON.load(response_content)
871
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
872
+ end
873
+
874
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
863
875
 
864
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
865
- promise = request.run_promise do |req|
866
- @client.credentials.sign_request(req) unless @client.credentials.nil?
876
+ result
867
877
  end
868
878
 
869
- promise = promise.then do |http_response|
879
+ promise.execute
880
+ end
881
+
882
+ #
883
+ # Gets list of applications from the current tenant.
884
+ #
885
+ # @param next_link [String] Next link for list operation.
886
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
887
+ # will be added to the HTTP request.
888
+ #
889
+ # @return [Array<Application>] operation results.
890
+ #
891
+ def list_next(next_link, custom_headers = nil)
892
+ response = list_next_async(next_link, custom_headers).value!
893
+ response.body unless response.nil?
894
+ end
895
+
896
+ #
897
+ # Gets list of applications from the current tenant.
898
+ #
899
+ # @param next_link [String] Next link for list operation.
900
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
901
+ # will be added to the HTTP request.
902
+ #
903
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
904
+ #
905
+ def list_next_with_http_info(next_link, custom_headers = nil)
906
+ list_next_async(next_link, custom_headers).value!
907
+ end
908
+
909
+ #
910
+ # Gets list of applications from the current tenant.
911
+ #
912
+ # @param next_link [String] Next link for list operation.
913
+ # @param [Hash{String => String}] A hash of custom headers that will be added
914
+ # to the HTTP request.
915
+ #
916
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
917
+ #
918
+ def list_next_async(next_link, custom_headers = nil)
919
+ fail ArgumentError, 'next_link is nil' if next_link.nil?
920
+ api_version = '1.6'
921
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
922
+
923
+
924
+ request_headers = {}
925
+
926
+ # Set Headers
927
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
928
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
929
+ path_template = '/{tenantID}/{nextLink}'
930
+
931
+ request_url = @base_url || @client.base_url
932
+
933
+ options = {
934
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
935
+ path_params: {'tenantID' => @client.tenant_id},
936
+ skip_encoding_path_params: {'nextLink' => next_link},
937
+ query_params: {'api-version' => api_version},
938
+ headers: request_headers.merge(custom_headers || {}),
939
+ base_url: request_url
940
+ }
941
+ promise = @client.make_request_async(:get, path_template, options)
942
+
943
+ promise = promise.then do |result|
944
+ http_response = result.response
870
945
  status_code = http_response.status
871
946
  response_content = http_response.body
872
- unless status_code == 204
947
+ unless status_code == 200
873
948
  error_model = JSON.load(response_content)
874
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
949
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
875
950
  end
876
951
 
877
- # Create Result
878
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
879
952
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
953
+ # Deserialize Response
954
+ if status_code == 200
955
+ begin
956
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
957
+ result_mapper = ApplicationListResult.mapper()
958
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
959
+ rescue Exception => e
960
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
961
+ end
962
+ end
880
963
 
881
964
  result
882
965
  end