azure_mgmt_support 0.17.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 (47) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2020-04-01/generated/azure_mgmt_support.rb +62 -0
  4. data/lib/2020-04-01/generated/azure_mgmt_support/communications.rb +661 -0
  5. data/lib/2020-04-01/generated/azure_mgmt_support/microsoft_support.rb +147 -0
  6. data/lib/2020-04-01/generated/azure_mgmt_support/models/check_name_availability_input.rb +59 -0
  7. data/lib/2020-04-01/generated/azure_mgmt_support/models/check_name_availability_output.rb +72 -0
  8. data/lib/2020-04-01/generated/azure_mgmt_support/models/communication_details.rb +145 -0
  9. data/lib/2020-04-01/generated/azure_mgmt_support/models/communication_direction.rb +16 -0
  10. data/lib/2020-04-01/generated/azure_mgmt_support/models/communication_type.rb +16 -0
  11. data/lib/2020-04-01/generated/azure_mgmt_support/models/communications_list_result.rb +99 -0
  12. data/lib/2020-04-01/generated/azure_mgmt_support/models/contact_profile.rb +156 -0
  13. data/lib/2020-04-01/generated/azure_mgmt_support/models/exception_response.rb +47 -0
  14. data/lib/2020-04-01/generated/azure_mgmt_support/models/operation.rb +59 -0
  15. data/lib/2020-04-01/generated/azure_mgmt_support/models/operation_display.rb +84 -0
  16. data/lib/2020-04-01/generated/azure_mgmt_support/models/operations_list_result.rb +56 -0
  17. data/lib/2020-04-01/generated/azure_mgmt_support/models/preferred_contact_method.rb +16 -0
  18. data/lib/2020-04-01/generated/azure_mgmt_support/models/problem_classification.rb +83 -0
  19. data/lib/2020-04-01/generated/azure_mgmt_support/models/problem_classifications_list_result.rb +56 -0
  20. data/lib/2020-04-01/generated/azure_mgmt_support/models/quota_change_request.rb +58 -0
  21. data/lib/2020-04-01/generated/azure_mgmt_support/models/quota_ticket_details.rb +82 -0
  22. data/lib/2020-04-01/generated/azure_mgmt_support/models/service.rb +101 -0
  23. data/lib/2020-04-01/generated/azure_mgmt_support/models/service_error.rb +89 -0
  24. data/lib/2020-04-01/generated/azure_mgmt_support/models/service_error_detail.rb +70 -0
  25. data/lib/2020-04-01/generated/azure_mgmt_support/models/service_level_agreement.rb +73 -0
  26. data/lib/2020-04-01/generated/azure_mgmt_support/models/services_list_result.rb +55 -0
  27. data/lib/2020-04-01/generated/azure_mgmt_support/models/severity_level.rb +18 -0
  28. data/lib/2020-04-01/generated/azure_mgmt_support/models/status.rb +16 -0
  29. data/lib/2020-04-01/generated/azure_mgmt_support/models/support_engineer.rb +48 -0
  30. data/lib/2020-04-01/generated/azure_mgmt_support/models/support_ticket_details.rb +321 -0
  31. data/lib/2020-04-01/generated/azure_mgmt_support/models/support_tickets_list_result.rb +99 -0
  32. data/lib/2020-04-01/generated/azure_mgmt_support/models/technical_ticket_details.rb +48 -0
  33. data/lib/2020-04-01/generated/azure_mgmt_support/models/type.rb +16 -0
  34. data/lib/2020-04-01/generated/azure_mgmt_support/models/update_contact_profile.rb +156 -0
  35. data/lib/2020-04-01/generated/azure_mgmt_support/models/update_support_ticket.rb +73 -0
  36. data/lib/2020-04-01/generated/azure_mgmt_support/module_definition.rb +9 -0
  37. data/lib/2020-04-01/generated/azure_mgmt_support/operations.rb +109 -0
  38. data/lib/2020-04-01/generated/azure_mgmt_support/problem_classifications.rb +219 -0
  39. data/lib/2020-04-01/generated/azure_mgmt_support/services.rb +222 -0
  40. data/lib/2020-04-01/generated/azure_mgmt_support/support_tickets.rb +854 -0
  41. data/lib/azure_mgmt_support.rb +6 -0
  42. data/lib/module_definition.rb +7 -0
  43. data/lib/profiles/latest/modules/support_profile_module.rb +189 -0
  44. data/lib/profiles/latest/support_latest_profile_client.rb +40 -0
  45. data/lib/profiles/latest/support_module_definition.rb +8 -0
  46. data/lib/version.rb +7 -0
  47. metadata +162 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 06ca042898070013537934ed82446bf3f0afe1a1b2b8bbc7c0ff9a42ba080ae2
4
+ data.tar.gz: 9ee93b55471f1f586b4800909d89c98d146a08072f51533df5db500b0f242993
5
+ SHA512:
6
+ metadata.gz: 89559cd0c4752b04e1f6517d9f8ebe94ddcc99a247fec6639542ce7f794dce9b9b5bb5fa2493c4fe85a653ec7d508841fe753421c48ac81e9f65e5f80ec9ba9c
7
+ data.tar.gz: 329f8a8b31e025855df60e480e46a3a26cc21062e2ac6e47b2bd49214d82f8061c1fa644437976d8d4e1f90fbee1cbabd5b01432b3a57fcd89861d17d2db9217
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,62 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2020-04-01/generated/azure_mgmt_support/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::Support::Mgmt::V2020_04_01
23
+ autoload :Operations, '2020-04-01/generated/azure_mgmt_support/operations.rb'
24
+ autoload :Services, '2020-04-01/generated/azure_mgmt_support/services.rb'
25
+ autoload :ProblemClassifications, '2020-04-01/generated/azure_mgmt_support/problem_classifications.rb'
26
+ autoload :SupportTickets, '2020-04-01/generated/azure_mgmt_support/support_tickets.rb'
27
+ autoload :Communications, '2020-04-01/generated/azure_mgmt_support/communications.rb'
28
+ autoload :MicrosoftSupport, '2020-04-01/generated/azure_mgmt_support/microsoft_support.rb'
29
+
30
+ module Models
31
+ autoload :TechnicalTicketDetails, '2020-04-01/generated/azure_mgmt_support/models/technical_ticket_details.rb'
32
+ autoload :OperationDisplay, '2020-04-01/generated/azure_mgmt_support/models/operation_display.rb'
33
+ autoload :QuotaChangeRequest, '2020-04-01/generated/azure_mgmt_support/models/quota_change_request.rb'
34
+ autoload :OperationsListResult, '2020-04-01/generated/azure_mgmt_support/models/operations_list_result.rb'
35
+ autoload :QuotaTicketDetails, '2020-04-01/generated/azure_mgmt_support/models/quota_ticket_details.rb'
36
+ autoload :ServicesListResult, '2020-04-01/generated/azure_mgmt_support/models/services_list_result.rb'
37
+ autoload :SupportTicketDetails, '2020-04-01/generated/azure_mgmt_support/models/support_ticket_details.rb'
38
+ autoload :ProblemClassificationsListResult, '2020-04-01/generated/azure_mgmt_support/models/problem_classifications_list_result.rb'
39
+ autoload :SupportTicketsListResult, '2020-04-01/generated/azure_mgmt_support/models/support_tickets_list_result.rb'
40
+ autoload :CheckNameAvailabilityOutput, '2020-04-01/generated/azure_mgmt_support/models/check_name_availability_output.rb'
41
+ autoload :CommunicationDetails, '2020-04-01/generated/azure_mgmt_support/models/communication_details.rb'
42
+ autoload :ServiceLevelAgreement, '2020-04-01/generated/azure_mgmt_support/models/service_level_agreement.rb'
43
+ autoload :CommunicationsListResult, '2020-04-01/generated/azure_mgmt_support/models/communications_list_result.rb'
44
+ autoload :Operation, '2020-04-01/generated/azure_mgmt_support/models/operation.rb'
45
+ autoload :ServiceErrorDetail, '2020-04-01/generated/azure_mgmt_support/models/service_error_detail.rb'
46
+ autoload :ProblemClassification, '2020-04-01/generated/azure_mgmt_support/models/problem_classification.rb'
47
+ autoload :ServiceError, '2020-04-01/generated/azure_mgmt_support/models/service_error.rb'
48
+ autoload :ContactProfile, '2020-04-01/generated/azure_mgmt_support/models/contact_profile.rb'
49
+ autoload :ExceptionResponse, '2020-04-01/generated/azure_mgmt_support/models/exception_response.rb'
50
+ autoload :Service, '2020-04-01/generated/azure_mgmt_support/models/service.rb'
51
+ autoload :UpdateContactProfile, '2020-04-01/generated/azure_mgmt_support/models/update_contact_profile.rb'
52
+ autoload :SupportEngineer, '2020-04-01/generated/azure_mgmt_support/models/support_engineer.rb'
53
+ autoload :UpdateSupportTicket, '2020-04-01/generated/azure_mgmt_support/models/update_support_ticket.rb'
54
+ autoload :CheckNameAvailabilityInput, '2020-04-01/generated/azure_mgmt_support/models/check_name_availability_input.rb'
55
+ autoload :Type, '2020-04-01/generated/azure_mgmt_support/models/type.rb'
56
+ autoload :SeverityLevel, '2020-04-01/generated/azure_mgmt_support/models/severity_level.rb'
57
+ autoload :PreferredContactMethod, '2020-04-01/generated/azure_mgmt_support/models/preferred_contact_method.rb'
58
+ autoload :CommunicationType, '2020-04-01/generated/azure_mgmt_support/models/communication_type.rb'
59
+ autoload :CommunicationDirection, '2020-04-01/generated/azure_mgmt_support/models/communication_direction.rb'
60
+ autoload :Status, '2020-04-01/generated/azure_mgmt_support/models/status.rb'
61
+ end
62
+ end
@@ -0,0 +1,661 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Support::Mgmt::V2020_04_01
7
+ #
8
+ # Microsoft Azure Support Resource Provider.
9
+ #
10
+ class Communications
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Communications class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [MicrosoftSupport] reference to the MicrosoftSupport
22
+ attr_reader :client
23
+
24
+ #
25
+ # Check the availability of a resource name. This API should be used to check
26
+ # the uniqueness of the name for adding a new communication to the support
27
+ # ticket.
28
+ #
29
+ # @param support_ticket_name [String] Support ticket name.
30
+ # @param check_name_availability_input [CheckNameAvailabilityInput] Input to
31
+ # check.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [CheckNameAvailabilityOutput] operation results.
36
+ #
37
+ def check_name_availability(support_ticket_name, check_name_availability_input, custom_headers:nil)
38
+ response = check_name_availability_async(support_ticket_name, check_name_availability_input, custom_headers:custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Check the availability of a resource name. This API should be used to check
44
+ # the uniqueness of the name for adding a new communication to the support
45
+ # ticket.
46
+ #
47
+ # @param support_ticket_name [String] Support ticket name.
48
+ # @param check_name_availability_input [CheckNameAvailabilityInput] Input to
49
+ # check.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def check_name_availability_with_http_info(support_ticket_name, check_name_availability_input, custom_headers:nil)
56
+ check_name_availability_async(support_ticket_name, check_name_availability_input, custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Check the availability of a resource name. This API should be used to check
61
+ # the uniqueness of the name for adding a new communication to the support
62
+ # ticket.
63
+ #
64
+ # @param support_ticket_name [String] Support ticket name.
65
+ # @param check_name_availability_input [CheckNameAvailabilityInput] Input to
66
+ # check.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def check_name_availability_async(support_ticket_name, check_name_availability_input, custom_headers:nil)
73
+ fail ArgumentError, 'support_ticket_name is nil' if support_ticket_name.nil?
74
+ fail ArgumentError, 'check_name_availability_input is nil' if check_name_availability_input.nil?
75
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
76
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
77
+
78
+
79
+ request_headers = {}
80
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
81
+
82
+ # Set Headers
83
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
84
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
85
+
86
+ # Serialize Request
87
+ request_mapper = Azure::Support::Mgmt::V2020_04_01::Models::CheckNameAvailabilityInput.mapper()
88
+ request_content = @client.serialize(request_mapper, check_name_availability_input)
89
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
90
+
91
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/checkNameAvailability'
92
+
93
+ request_url = @base_url || @client.base_url
94
+
95
+ options = {
96
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
97
+ path_params: {'supportTicketName' => support_ticket_name,'subscriptionId' => @client.subscription_id},
98
+ query_params: {'api-version' => @client.api_version},
99
+ body: request_content,
100
+ headers: request_headers.merge(custom_headers || {}),
101
+ base_url: request_url
102
+ }
103
+ promise = @client.make_request_async(:post, path_template, options)
104
+
105
+ promise = promise.then do |result|
106
+ http_response = result.response
107
+ status_code = http_response.status
108
+ response_content = http_response.body
109
+ unless status_code == 200
110
+ error_model = JSON.load(response_content)
111
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
112
+ end
113
+
114
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
115
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
116
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
117
+ # Deserialize Response
118
+ if status_code == 200
119
+ begin
120
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
121
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::CheckNameAvailabilityOutput.mapper()
122
+ result.body = @client.deserialize(result_mapper, parsed_response)
123
+ rescue Exception => e
124
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
125
+ end
126
+ end
127
+
128
+ result
129
+ end
130
+
131
+ promise.execute
132
+ end
133
+
134
+ #
135
+ # Lists all communications (attachments not included) for a support ticket.
136
+ # <br/></br> You can also filter support ticket communications by _CreatedDate_
137
+ # or _CommunicationType_ using the $filter parameter. The only type of
138
+ # communication supported today is _Web_. Output will be a paged result with
139
+ # _nextLink_, using which you can retrieve the next set of Communication
140
+ # results. <br/><br/>Support ticket data is available for 12 months after
141
+ # ticket creation. If a ticket was created more than 12 months ago, a request
142
+ # for data might cause an error.
143
+ #
144
+ # @param support_ticket_name [String] Support ticket name.
145
+ # @param top [Integer] The number of values to return in the collection.
146
+ # Default is 10 and max is 10.
147
+ # @param filter [String] The filter to apply on the operation. You can filter
148
+ # by communicationType and createdDate properties. CommunicationType supports
149
+ # Equals ('eq') operator and createdDate supports Greater Than ('gt') and
150
+ # Greater Than or Equals ('ge') operators. You may combine the
151
+ # CommunicationType and CreatedDate filters by Logical And ('and') operator.
152
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
153
+ # will be added to the HTTP request.
154
+ #
155
+ # @return [Array<CommunicationDetails>] operation results.
156
+ #
157
+ def list(support_ticket_name, top:nil, filter:nil, custom_headers:nil)
158
+ first_page = list_as_lazy(support_ticket_name, top:top, filter:filter, custom_headers:custom_headers)
159
+ first_page.get_all_items
160
+ end
161
+
162
+ #
163
+ # Lists all communications (attachments not included) for a support ticket.
164
+ # <br/></br> You can also filter support ticket communications by _CreatedDate_
165
+ # or _CommunicationType_ using the $filter parameter. The only type of
166
+ # communication supported today is _Web_. Output will be a paged result with
167
+ # _nextLink_, using which you can retrieve the next set of Communication
168
+ # results. <br/><br/>Support ticket data is available for 12 months after
169
+ # ticket creation. If a ticket was created more than 12 months ago, a request
170
+ # for data might cause an error.
171
+ #
172
+ # @param support_ticket_name [String] Support ticket name.
173
+ # @param top [Integer] The number of values to return in the collection.
174
+ # Default is 10 and max is 10.
175
+ # @param filter [String] The filter to apply on the operation. You can filter
176
+ # by communicationType and createdDate properties. CommunicationType supports
177
+ # Equals ('eq') operator and createdDate supports Greater Than ('gt') and
178
+ # Greater Than or Equals ('ge') operators. You may combine the
179
+ # CommunicationType and CreatedDate filters by Logical And ('and') operator.
180
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
181
+ # will be added to the HTTP request.
182
+ #
183
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
184
+ #
185
+ def list_with_http_info(support_ticket_name, top:nil, filter:nil, custom_headers:nil)
186
+ list_async(support_ticket_name, top:top, filter:filter, custom_headers:custom_headers).value!
187
+ end
188
+
189
+ #
190
+ # Lists all communications (attachments not included) for a support ticket.
191
+ # <br/></br> You can also filter support ticket communications by _CreatedDate_
192
+ # or _CommunicationType_ using the $filter parameter. The only type of
193
+ # communication supported today is _Web_. Output will be a paged result with
194
+ # _nextLink_, using which you can retrieve the next set of Communication
195
+ # results. <br/><br/>Support ticket data is available for 12 months after
196
+ # ticket creation. If a ticket was created more than 12 months ago, a request
197
+ # for data might cause an error.
198
+ #
199
+ # @param support_ticket_name [String] Support ticket name.
200
+ # @param top [Integer] The number of values to return in the collection.
201
+ # Default is 10 and max is 10.
202
+ # @param filter [String] The filter to apply on the operation. You can filter
203
+ # by communicationType and createdDate properties. CommunicationType supports
204
+ # Equals ('eq') operator and createdDate supports Greater Than ('gt') and
205
+ # Greater Than or Equals ('ge') operators. You may combine the
206
+ # CommunicationType and CreatedDate filters by Logical And ('and') operator.
207
+ # @param [Hash{String => String}] A hash of custom headers that will be added
208
+ # to the HTTP request.
209
+ #
210
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
211
+ #
212
+ def list_async(support_ticket_name, top:nil, filter:nil, custom_headers:nil)
213
+ fail ArgumentError, 'support_ticket_name is nil' if support_ticket_name.nil?
214
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
215
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
216
+
217
+
218
+ request_headers = {}
219
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
220
+
221
+ # Set Headers
222
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
223
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
224
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications'
225
+
226
+ request_url = @base_url || @client.base_url
227
+
228
+ options = {
229
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
230
+ path_params: {'supportTicketName' => support_ticket_name,'subscriptionId' => @client.subscription_id},
231
+ query_params: {'$top' => top,'$filter' => filter,'api-version' => @client.api_version},
232
+ headers: request_headers.merge(custom_headers || {}),
233
+ base_url: request_url
234
+ }
235
+ promise = @client.make_request_async(:get, path_template, options)
236
+
237
+ promise = promise.then do |result|
238
+ http_response = result.response
239
+ status_code = http_response.status
240
+ response_content = http_response.body
241
+ unless status_code == 200
242
+ error_model = JSON.load(response_content)
243
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
244
+ end
245
+
246
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
247
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
248
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
249
+ # Deserialize Response
250
+ if status_code == 200
251
+ begin
252
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
253
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::CommunicationsListResult.mapper()
254
+ result.body = @client.deserialize(result_mapper, parsed_response)
255
+ rescue Exception => e
256
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
257
+ end
258
+ end
259
+
260
+ result
261
+ end
262
+
263
+ promise.execute
264
+ end
265
+
266
+ #
267
+ # Returns communication details for a support ticket.
268
+ #
269
+ # @param support_ticket_name [String] Support ticket name.
270
+ # @param communication_name [String] Communication name.
271
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
272
+ # will be added to the HTTP request.
273
+ #
274
+ # @return [CommunicationDetails] operation results.
275
+ #
276
+ def get(support_ticket_name, communication_name, custom_headers:nil)
277
+ response = get_async(support_ticket_name, communication_name, custom_headers:custom_headers).value!
278
+ response.body unless response.nil?
279
+ end
280
+
281
+ #
282
+ # Returns communication details for a support ticket.
283
+ #
284
+ # @param support_ticket_name [String] Support ticket name.
285
+ # @param communication_name [String] Communication name.
286
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
287
+ # will be added to the HTTP request.
288
+ #
289
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
290
+ #
291
+ def get_with_http_info(support_ticket_name, communication_name, custom_headers:nil)
292
+ get_async(support_ticket_name, communication_name, custom_headers:custom_headers).value!
293
+ end
294
+
295
+ #
296
+ # Returns communication details for a support ticket.
297
+ #
298
+ # @param support_ticket_name [String] Support ticket name.
299
+ # @param communication_name [String] Communication name.
300
+ # @param [Hash{String => String}] A hash of custom headers that will be added
301
+ # to the HTTP request.
302
+ #
303
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
304
+ #
305
+ def get_async(support_ticket_name, communication_name, custom_headers:nil)
306
+ fail ArgumentError, 'support_ticket_name is nil' if support_ticket_name.nil?
307
+ fail ArgumentError, 'communication_name is nil' if communication_name.nil?
308
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
309
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
310
+
311
+
312
+ request_headers = {}
313
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
314
+
315
+ # Set Headers
316
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
317
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
318
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}'
319
+
320
+ request_url = @base_url || @client.base_url
321
+
322
+ options = {
323
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
324
+ path_params: {'supportTicketName' => support_ticket_name,'communicationName' => communication_name,'subscriptionId' => @client.subscription_id},
325
+ query_params: {'api-version' => @client.api_version},
326
+ headers: request_headers.merge(custom_headers || {}),
327
+ base_url: request_url
328
+ }
329
+ promise = @client.make_request_async(:get, path_template, options)
330
+
331
+ promise = promise.then do |result|
332
+ http_response = result.response
333
+ status_code = http_response.status
334
+ response_content = http_response.body
335
+ unless status_code == 200
336
+ error_model = JSON.load(response_content)
337
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
338
+ end
339
+
340
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
341
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
342
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
343
+ # Deserialize Response
344
+ if status_code == 200
345
+ begin
346
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
347
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::CommunicationDetails.mapper()
348
+ result.body = @client.deserialize(result_mapper, parsed_response)
349
+ rescue Exception => e
350
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
351
+ end
352
+ end
353
+
354
+ result
355
+ end
356
+
357
+ promise.execute
358
+ end
359
+
360
+ #
361
+ # Adds a new customer communication to an Azure support ticket.
362
+ #
363
+ # @param support_ticket_name [String] Support ticket name.
364
+ # @param communication_name [String] Communication name.
365
+ # @param create_communication_parameters [CommunicationDetails] Communication
366
+ # object.
367
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
368
+ # will be added to the HTTP request.
369
+ #
370
+ # @return [CommunicationDetails] operation results.
371
+ #
372
+ def create(support_ticket_name, communication_name, create_communication_parameters, custom_headers:nil)
373
+ response = create_async(support_ticket_name, communication_name, create_communication_parameters, custom_headers:custom_headers).value!
374
+ response.body unless response.nil?
375
+ end
376
+
377
+ #
378
+ # @param support_ticket_name [String] Support ticket name.
379
+ # @param communication_name [String] Communication name.
380
+ # @param create_communication_parameters [CommunicationDetails] Communication
381
+ # object.
382
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
383
+ # will be added to the HTTP request.
384
+ #
385
+ # @return [Concurrent::Promise] promise which provides async access to http
386
+ # response.
387
+ #
388
+ def create_async(support_ticket_name, communication_name, create_communication_parameters, custom_headers:nil)
389
+ # Send request
390
+ promise = begin_create_async(support_ticket_name, communication_name, create_communication_parameters, custom_headers:custom_headers)
391
+
392
+ promise = promise.then do |response|
393
+ # Defining deserialization method.
394
+ deserialize_method = lambda do |parsed_response|
395
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::CommunicationDetails.mapper()
396
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
397
+ end
398
+
399
+ # Waiting for response.
400
+ @client.get_long_running_operation_result(response, deserialize_method)
401
+ end
402
+
403
+ promise
404
+ end
405
+
406
+ #
407
+ # Adds a new customer communication to an Azure support ticket.
408
+ #
409
+ # @param support_ticket_name [String] Support ticket name.
410
+ # @param communication_name [String] Communication name.
411
+ # @param create_communication_parameters [CommunicationDetails] Communication
412
+ # object.
413
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
414
+ # will be added to the HTTP request.
415
+ #
416
+ # @return [CommunicationDetails] operation results.
417
+ #
418
+ def begin_create(support_ticket_name, communication_name, create_communication_parameters, custom_headers:nil)
419
+ response = begin_create_async(support_ticket_name, communication_name, create_communication_parameters, custom_headers:custom_headers).value!
420
+ response.body unless response.nil?
421
+ end
422
+
423
+ #
424
+ # Adds a new customer communication to an Azure support ticket.
425
+ #
426
+ # @param support_ticket_name [String] Support ticket name.
427
+ # @param communication_name [String] Communication name.
428
+ # @param create_communication_parameters [CommunicationDetails] Communication
429
+ # object.
430
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
431
+ # will be added to the HTTP request.
432
+ #
433
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
434
+ #
435
+ def begin_create_with_http_info(support_ticket_name, communication_name, create_communication_parameters, custom_headers:nil)
436
+ begin_create_async(support_ticket_name, communication_name, create_communication_parameters, custom_headers:custom_headers).value!
437
+ end
438
+
439
+ #
440
+ # Adds a new customer communication to an Azure support ticket.
441
+ #
442
+ # @param support_ticket_name [String] Support ticket name.
443
+ # @param communication_name [String] Communication name.
444
+ # @param create_communication_parameters [CommunicationDetails] Communication
445
+ # object.
446
+ # @param [Hash{String => String}] A hash of custom headers that will be added
447
+ # to the HTTP request.
448
+ #
449
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
450
+ #
451
+ def begin_create_async(support_ticket_name, communication_name, create_communication_parameters, custom_headers:nil)
452
+ fail ArgumentError, 'support_ticket_name is nil' if support_ticket_name.nil?
453
+ fail ArgumentError, 'communication_name is nil' if communication_name.nil?
454
+ fail ArgumentError, 'create_communication_parameters is nil' if create_communication_parameters.nil?
455
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
456
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
457
+
458
+
459
+ request_headers = {}
460
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
461
+
462
+ # Set Headers
463
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
464
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
465
+
466
+ # Serialize Request
467
+ request_mapper = Azure::Support::Mgmt::V2020_04_01::Models::CommunicationDetails.mapper()
468
+ request_content = @client.serialize(request_mapper, create_communication_parameters)
469
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
470
+
471
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}'
472
+
473
+ request_url = @base_url || @client.base_url
474
+
475
+ options = {
476
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
477
+ path_params: {'supportTicketName' => support_ticket_name,'communicationName' => communication_name,'subscriptionId' => @client.subscription_id},
478
+ query_params: {'api-version' => @client.api_version},
479
+ body: request_content,
480
+ headers: request_headers.merge(custom_headers || {}),
481
+ base_url: request_url
482
+ }
483
+ promise = @client.make_request_async(:put, path_template, options)
484
+
485
+ promise = promise.then do |result|
486
+ http_response = result.response
487
+ status_code = http_response.status
488
+ response_content = http_response.body
489
+ unless status_code == 200 || status_code == 202
490
+ error_model = JSON.load(response_content)
491
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
492
+ end
493
+
494
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
495
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
496
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
497
+ # Deserialize Response
498
+ if status_code == 200
499
+ begin
500
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
501
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::CommunicationDetails.mapper()
502
+ result.body = @client.deserialize(result_mapper, parsed_response)
503
+ rescue Exception => e
504
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
505
+ end
506
+ end
507
+
508
+ result
509
+ end
510
+
511
+ promise.execute
512
+ end
513
+
514
+ #
515
+ # Lists all communications (attachments not included) for a support ticket.
516
+ # <br/></br> You can also filter support ticket communications by _CreatedDate_
517
+ # or _CommunicationType_ using the $filter parameter. The only type of
518
+ # communication supported today is _Web_. Output will be a paged result with
519
+ # _nextLink_, using which you can retrieve the next set of Communication
520
+ # results. <br/><br/>Support ticket data is available for 12 months after
521
+ # ticket creation. If a ticket was created more than 12 months ago, a request
522
+ # for data might cause an error.
523
+ #
524
+ # @param next_page_link [String] The NextLink from the previous successful call
525
+ # to List operation.
526
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
527
+ # will be added to the HTTP request.
528
+ #
529
+ # @return [CommunicationsListResult] operation results.
530
+ #
531
+ def list_next(next_page_link, custom_headers:nil)
532
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
533
+ response.body unless response.nil?
534
+ end
535
+
536
+ #
537
+ # Lists all communications (attachments not included) for a support ticket.
538
+ # <br/></br> You can also filter support ticket communications by _CreatedDate_
539
+ # or _CommunicationType_ using the $filter parameter. The only type of
540
+ # communication supported today is _Web_. Output will be a paged result with
541
+ # _nextLink_, using which you can retrieve the next set of Communication
542
+ # results. <br/><br/>Support ticket data is available for 12 months after
543
+ # ticket creation. If a ticket was created more than 12 months ago, a request
544
+ # for data might cause an error.
545
+ #
546
+ # @param next_page_link [String] The NextLink from the previous successful call
547
+ # to List operation.
548
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
549
+ # will be added to the HTTP request.
550
+ #
551
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
552
+ #
553
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
554
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
555
+ end
556
+
557
+ #
558
+ # Lists all communications (attachments not included) for a support ticket.
559
+ # <br/></br> You can also filter support ticket communications by _CreatedDate_
560
+ # or _CommunicationType_ using the $filter parameter. The only type of
561
+ # communication supported today is _Web_. Output will be a paged result with
562
+ # _nextLink_, using which you can retrieve the next set of Communication
563
+ # results. <br/><br/>Support ticket data is available for 12 months after
564
+ # ticket creation. If a ticket was created more than 12 months ago, a request
565
+ # for data might cause an error.
566
+ #
567
+ # @param next_page_link [String] The NextLink from the previous successful call
568
+ # to List operation.
569
+ # @param [Hash{String => String}] A hash of custom headers that will be added
570
+ # to the HTTP request.
571
+ #
572
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
573
+ #
574
+ def list_next_async(next_page_link, custom_headers:nil)
575
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
576
+
577
+
578
+ request_headers = {}
579
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
580
+
581
+ # Set Headers
582
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
583
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
584
+ path_template = '{nextLink}'
585
+
586
+ request_url = @base_url || @client.base_url
587
+
588
+ options = {
589
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
590
+ skip_encoding_path_params: {'nextLink' => next_page_link},
591
+ headers: request_headers.merge(custom_headers || {}),
592
+ base_url: request_url
593
+ }
594
+ promise = @client.make_request_async(:get, path_template, options)
595
+
596
+ promise = promise.then do |result|
597
+ http_response = result.response
598
+ status_code = http_response.status
599
+ response_content = http_response.body
600
+ unless status_code == 200
601
+ error_model = JSON.load(response_content)
602
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
603
+ end
604
+
605
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
606
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
607
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
608
+ # Deserialize Response
609
+ if status_code == 200
610
+ begin
611
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
612
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::CommunicationsListResult.mapper()
613
+ result.body = @client.deserialize(result_mapper, parsed_response)
614
+ rescue Exception => e
615
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
616
+ end
617
+ end
618
+
619
+ result
620
+ end
621
+
622
+ promise.execute
623
+ end
624
+
625
+ #
626
+ # Lists all communications (attachments not included) for a support ticket.
627
+ # <br/></br> You can also filter support ticket communications by _CreatedDate_
628
+ # or _CommunicationType_ using the $filter parameter. The only type of
629
+ # communication supported today is _Web_. Output will be a paged result with
630
+ # _nextLink_, using which you can retrieve the next set of Communication
631
+ # results. <br/><br/>Support ticket data is available for 12 months after
632
+ # ticket creation. If a ticket was created more than 12 months ago, a request
633
+ # for data might cause an error.
634
+ #
635
+ # @param support_ticket_name [String] Support ticket name.
636
+ # @param top [Integer] The number of values to return in the collection.
637
+ # Default is 10 and max is 10.
638
+ # @param filter [String] The filter to apply on the operation. You can filter
639
+ # by communicationType and createdDate properties. CommunicationType supports
640
+ # Equals ('eq') operator and createdDate supports Greater Than ('gt') and
641
+ # Greater Than or Equals ('ge') operators. You may combine the
642
+ # CommunicationType and CreatedDate filters by Logical And ('and') operator.
643
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
644
+ # will be added to the HTTP request.
645
+ #
646
+ # @return [CommunicationsListResult] which provide lazy access to pages of the
647
+ # response.
648
+ #
649
+ def list_as_lazy(support_ticket_name, top:nil, filter:nil, custom_headers:nil)
650
+ response = list_async(support_ticket_name, top:top, filter:filter, custom_headers:custom_headers).value!
651
+ unless response.nil?
652
+ page = response.body
653
+ page.next_method = Proc.new do |next_page_link|
654
+ list_next_async(next_page_link, custom_headers:custom_headers)
655
+ end
656
+ page
657
+ end
658
+ end
659
+
660
+ end
661
+ end