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,219 @@
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 ProblemClassifications
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ProblemClassifications 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
+ # Lists all the problem classifications (categories) available for a specific
26
+ # Azure service. Always use the service and problem classifications obtained
27
+ # programmatically. This practice ensures that you always have the most recent
28
+ # set of service and problem classification Ids.
29
+ #
30
+ # @param service_name [String] Name of the Azure service for which the problem
31
+ # classifications need to be retrieved.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [ProblemClassificationsListResult] operation results.
36
+ #
37
+ def list(service_name, custom_headers:nil)
38
+ response = list_async(service_name, custom_headers:custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Lists all the problem classifications (categories) available for a specific
44
+ # Azure service. Always use the service and problem classifications obtained
45
+ # programmatically. This practice ensures that you always have the most recent
46
+ # set of service and problem classification Ids.
47
+ #
48
+ # @param service_name [String] Name of the Azure service for which the problem
49
+ # classifications need to be retrieved.
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 list_with_http_info(service_name, custom_headers:nil)
56
+ list_async(service_name, custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Lists all the problem classifications (categories) available for a specific
61
+ # Azure service. Always use the service and problem classifications obtained
62
+ # programmatically. This practice ensures that you always have the most recent
63
+ # set of service and problem classification Ids.
64
+ #
65
+ # @param service_name [String] Name of the Azure service for which the problem
66
+ # classifications need to be retrieved.
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 list_async(service_name, custom_headers:nil)
73
+ fail ArgumentError, 'service_name is nil' if service_name.nil?
74
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
75
+
76
+
77
+ request_headers = {}
78
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
79
+
80
+ # Set Headers
81
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
82
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
83
+ path_template = 'providers/Microsoft.Support/services/{serviceName}/problemClassifications'
84
+
85
+ request_url = @base_url || @client.base_url
86
+
87
+ options = {
88
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
89
+ path_params: {'serviceName' => service_name},
90
+ query_params: {'api-version' => @client.api_version},
91
+ headers: request_headers.merge(custom_headers || {}),
92
+ base_url: request_url
93
+ }
94
+ promise = @client.make_request_async(:get, path_template, options)
95
+
96
+ promise = promise.then do |result|
97
+ http_response = result.response
98
+ status_code = http_response.status
99
+ response_content = http_response.body
100
+ unless status_code == 200
101
+ error_model = JSON.load(response_content)
102
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
103
+ end
104
+
105
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
106
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
107
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
108
+ # Deserialize Response
109
+ if status_code == 200
110
+ begin
111
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
112
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::ProblemClassificationsListResult.mapper()
113
+ result.body = @client.deserialize(result_mapper, parsed_response)
114
+ rescue Exception => e
115
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
116
+ end
117
+ end
118
+
119
+ result
120
+ end
121
+
122
+ promise.execute
123
+ end
124
+
125
+ #
126
+ # Get problem classification details for a specific Azure service.
127
+ #
128
+ # @param service_name [String] Name of the Azure service available for support.
129
+ # @param problem_classification_name [String] Name of problem classification.
130
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
131
+ # will be added to the HTTP request.
132
+ #
133
+ # @return [ProblemClassification] operation results.
134
+ #
135
+ def get(service_name, problem_classification_name, custom_headers:nil)
136
+ response = get_async(service_name, problem_classification_name, custom_headers:custom_headers).value!
137
+ response.body unless response.nil?
138
+ end
139
+
140
+ #
141
+ # Get problem classification details for a specific Azure service.
142
+ #
143
+ # @param service_name [String] Name of the Azure service available for support.
144
+ # @param problem_classification_name [String] Name of problem classification.
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
149
+ #
150
+ def get_with_http_info(service_name, problem_classification_name, custom_headers:nil)
151
+ get_async(service_name, problem_classification_name, custom_headers:custom_headers).value!
152
+ end
153
+
154
+ #
155
+ # Get problem classification details for a specific Azure service.
156
+ #
157
+ # @param service_name [String] Name of the Azure service available for support.
158
+ # @param problem_classification_name [String] Name of problem classification.
159
+ # @param [Hash{String => String}] A hash of custom headers that will be added
160
+ # to the HTTP request.
161
+ #
162
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
163
+ #
164
+ def get_async(service_name, problem_classification_name, custom_headers:nil)
165
+ fail ArgumentError, 'service_name is nil' if service_name.nil?
166
+ fail ArgumentError, 'problem_classification_name is nil' if problem_classification_name.nil?
167
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
168
+
169
+
170
+ request_headers = {}
171
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
172
+
173
+ # Set Headers
174
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
175
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
176
+ path_template = 'providers/Microsoft.Support/services/{serviceName}/problemClassifications/{problemClassificationName}'
177
+
178
+ request_url = @base_url || @client.base_url
179
+
180
+ options = {
181
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
182
+ path_params: {'serviceName' => service_name,'problemClassificationName' => problem_classification_name},
183
+ query_params: {'api-version' => @client.api_version},
184
+ headers: request_headers.merge(custom_headers || {}),
185
+ base_url: request_url
186
+ }
187
+ promise = @client.make_request_async(:get, path_template, options)
188
+
189
+ promise = promise.then do |result|
190
+ http_response = result.response
191
+ status_code = http_response.status
192
+ response_content = http_response.body
193
+ unless status_code == 200
194
+ error_model = JSON.load(response_content)
195
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
196
+ end
197
+
198
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
199
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
200
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
201
+ # Deserialize Response
202
+ if status_code == 200
203
+ begin
204
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
205
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::ProblemClassification.mapper()
206
+ result.body = @client.deserialize(result_mapper, parsed_response)
207
+ rescue Exception => e
208
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
209
+ end
210
+ end
211
+
212
+ result
213
+ end
214
+
215
+ promise.execute
216
+ end
217
+
218
+ end
219
+ end
@@ -0,0 +1,222 @@
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 Services
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Services 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
+ # Lists all the Azure services available for support ticket creation. For
26
+ # **Technical** issues, select the Service Id that maps to the Azure
27
+ # service/product as displayed in the **Services** drop-down list on the Azure
28
+ # portal's [New support
29
+ # request](https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/overview)
30
+ # page. Always use the service and its corresponding problem classification(s)
31
+ # obtained programmatically for support ticket creation. This practice ensures
32
+ # that you always have the most recent set of service and problem
33
+ # classification Ids.
34
+ #
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ # @return [ServicesListResult] operation results.
39
+ #
40
+ def list(custom_headers:nil)
41
+ response = list_async(custom_headers:custom_headers).value!
42
+ response.body unless response.nil?
43
+ end
44
+
45
+ #
46
+ # Lists all the Azure services available for support ticket creation. For
47
+ # **Technical** issues, select the Service Id that maps to the Azure
48
+ # service/product as displayed in the **Services** drop-down list on the Azure
49
+ # portal's [New support
50
+ # request](https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/overview)
51
+ # page. Always use the service and its corresponding problem classification(s)
52
+ # obtained programmatically for support ticket creation. This practice ensures
53
+ # that you always have the most recent set of service and problem
54
+ # classification Ids.
55
+ #
56
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
57
+ # will be added to the HTTP request.
58
+ #
59
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
60
+ #
61
+ def list_with_http_info(custom_headers:nil)
62
+ list_async(custom_headers:custom_headers).value!
63
+ end
64
+
65
+ #
66
+ # Lists all the Azure services available for support ticket creation. For
67
+ # **Technical** issues, select the Service Id that maps to the Azure
68
+ # service/product as displayed in the **Services** drop-down list on the Azure
69
+ # portal's [New support
70
+ # request](https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/overview)
71
+ # page. Always use the service and its corresponding problem classification(s)
72
+ # obtained programmatically for support ticket creation. This practice ensures
73
+ # that you always have the most recent set of service and problem
74
+ # classification Ids.
75
+ #
76
+ # @param [Hash{String => String}] A hash of custom headers that will be added
77
+ # to the HTTP request.
78
+ #
79
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
80
+ #
81
+ def list_async(custom_headers:nil)
82
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
83
+
84
+
85
+ request_headers = {}
86
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
87
+
88
+ # Set Headers
89
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
90
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
91
+ path_template = 'providers/Microsoft.Support/services'
92
+
93
+ request_url = @base_url || @client.base_url
94
+
95
+ options = {
96
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
97
+ query_params: {'api-version' => @client.api_version},
98
+ headers: request_headers.merge(custom_headers || {}),
99
+ base_url: request_url
100
+ }
101
+ promise = @client.make_request_async(:get, path_template, options)
102
+
103
+ promise = promise.then do |result|
104
+ http_response = result.response
105
+ status_code = http_response.status
106
+ response_content = http_response.body
107
+ unless status_code == 200
108
+ error_model = JSON.load(response_content)
109
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
110
+ end
111
+
112
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
113
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
114
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
115
+ # Deserialize Response
116
+ if status_code == 200
117
+ begin
118
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
119
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::ServicesListResult.mapper()
120
+ result.body = @client.deserialize(result_mapper, parsed_response)
121
+ rescue Exception => e
122
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
123
+ end
124
+ end
125
+
126
+ result
127
+ end
128
+
129
+ promise.execute
130
+ end
131
+
132
+ #
133
+ # Gets a specific Azure service for support ticket creation.
134
+ #
135
+ # @param service_name [String] Name of the Azure service.
136
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
137
+ # will be added to the HTTP request.
138
+ #
139
+ # @return [Service] operation results.
140
+ #
141
+ def get(service_name, custom_headers:nil)
142
+ response = get_async(service_name, custom_headers:custom_headers).value!
143
+ response.body unless response.nil?
144
+ end
145
+
146
+ #
147
+ # Gets a specific Azure service for support ticket creation.
148
+ #
149
+ # @param service_name [String] Name of the Azure service.
150
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
151
+ # will be added to the HTTP request.
152
+ #
153
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
154
+ #
155
+ def get_with_http_info(service_name, custom_headers:nil)
156
+ get_async(service_name, custom_headers:custom_headers).value!
157
+ end
158
+
159
+ #
160
+ # Gets a specific Azure service for support ticket creation.
161
+ #
162
+ # @param service_name [String] Name of the Azure service.
163
+ # @param [Hash{String => String}] A hash of custom headers that will be added
164
+ # to the HTTP request.
165
+ #
166
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
167
+ #
168
+ def get_async(service_name, custom_headers:nil)
169
+ fail ArgumentError, 'service_name is nil' if service_name.nil?
170
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
171
+
172
+
173
+ request_headers = {}
174
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
175
+
176
+ # Set Headers
177
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
178
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
179
+ path_template = 'providers/Microsoft.Support/services/{serviceName}'
180
+
181
+ request_url = @base_url || @client.base_url
182
+
183
+ options = {
184
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
185
+ path_params: {'serviceName' => service_name},
186
+ query_params: {'api-version' => @client.api_version},
187
+ headers: request_headers.merge(custom_headers || {}),
188
+ base_url: request_url
189
+ }
190
+ promise = @client.make_request_async(:get, path_template, options)
191
+
192
+ promise = promise.then do |result|
193
+ http_response = result.response
194
+ status_code = http_response.status
195
+ response_content = http_response.body
196
+ unless status_code == 200
197
+ error_model = JSON.load(response_content)
198
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
199
+ end
200
+
201
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
202
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
203
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
204
+ # Deserialize Response
205
+ if status_code == 200
206
+ begin
207
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
208
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::Service.mapper()
209
+ result.body = @client.deserialize(result_mapper, parsed_response)
210
+ rescue Exception => e
211
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
212
+ end
213
+ end
214
+
215
+ result
216
+ end
217
+
218
+ promise.execute
219
+ end
220
+
221
+ end
222
+ end
@@ -0,0 +1,854 @@
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 SupportTickets
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the SupportTickets 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 support ticket creation for the selected
27
+ # subscription.
28
+ #
29
+ # @param check_name_availability_input [CheckNameAvailabilityInput] Input to
30
+ # check.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [CheckNameAvailabilityOutput] operation results.
35
+ #
36
+ def check_name_availability(check_name_availability_input, custom_headers:nil)
37
+ response = check_name_availability_async(check_name_availability_input, custom_headers:custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Check the availability of a resource name. This API should be used to check
43
+ # the uniqueness of the name for support ticket creation for the selected
44
+ # subscription.
45
+ #
46
+ # @param check_name_availability_input [CheckNameAvailabilityInput] Input to
47
+ # check.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def check_name_availability_with_http_info(check_name_availability_input, custom_headers:nil)
54
+ check_name_availability_async(check_name_availability_input, custom_headers:custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Check the availability of a resource name. This API should be used to check
59
+ # the uniqueness of the name for support ticket creation for the selected
60
+ # subscription.
61
+ #
62
+ # @param check_name_availability_input [CheckNameAvailabilityInput] Input to
63
+ # check.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def check_name_availability_async(check_name_availability_input, custom_headers:nil)
70
+ fail ArgumentError, 'check_name_availability_input is nil' if check_name_availability_input.nil?
71
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
72
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
73
+
74
+
75
+ request_headers = {}
76
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
77
+
78
+ # Set Headers
79
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
80
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
81
+
82
+ # Serialize Request
83
+ request_mapper = Azure::Support::Mgmt::V2020_04_01::Models::CheckNameAvailabilityInput.mapper()
84
+ request_content = @client.serialize(request_mapper, check_name_availability_input)
85
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
86
+
87
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Support/checkNameAvailability'
88
+
89
+ request_url = @base_url || @client.base_url
90
+
91
+ options = {
92
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
93
+ path_params: {'subscriptionId' => @client.subscription_id},
94
+ query_params: {'api-version' => @client.api_version},
95
+ body: request_content,
96
+ headers: request_headers.merge(custom_headers || {}),
97
+ base_url: request_url
98
+ }
99
+ promise = @client.make_request_async(:post, path_template, options)
100
+
101
+ promise = promise.then do |result|
102
+ http_response = result.response
103
+ status_code = http_response.status
104
+ response_content = http_response.body
105
+ unless status_code == 200
106
+ error_model = JSON.load(response_content)
107
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
108
+ end
109
+
110
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
111
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
112
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
113
+ # Deserialize Response
114
+ if status_code == 200
115
+ begin
116
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
117
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::CheckNameAvailabilityOutput.mapper()
118
+ result.body = @client.deserialize(result_mapper, parsed_response)
119
+ rescue Exception => e
120
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
121
+ end
122
+ end
123
+
124
+ result
125
+ end
126
+
127
+ promise.execute
128
+ end
129
+
130
+ #
131
+ # Lists all the support tickets for an Azure subscription. You can also filter
132
+ # the support tickets by _Status_ or _CreatedDate_ using the $filter parameter.
133
+ # Output will be a paged result with _nextLink_, using which you can retrieve
134
+ # the next set of support tickets. <br/><br/>Support ticket data is available
135
+ # for 12 months after ticket creation. If a ticket was created more than 12
136
+ # months ago, a request for data might cause an error.
137
+ #
138
+ # @param top [Integer] The number of values to return in the collection.
139
+ # Default is 25 and max is 100.
140
+ # @param filter [String] The filter to apply on the operation. We support
141
+ # 'odata v4.0' filter semantics. [Learn
142
+ # more](https://docs.microsoft.com/odata/concepts/queryoptions-overview).
143
+ # _Status_ filter can only be used with Equals ('eq') operator. For
144
+ # _CreatedDate_ filter, the supported operators are Greater Than ('gt') and
145
+ # Greater Than or Equals ('ge'). When using both filters, combine them using
146
+ # the logical 'AND'.
147
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
148
+ # will be added to the HTTP request.
149
+ #
150
+ # @return [Array<SupportTicketDetails>] operation results.
151
+ #
152
+ def list(top:nil, filter:nil, custom_headers:nil)
153
+ first_page = list_as_lazy(top:top, filter:filter, custom_headers:custom_headers)
154
+ first_page.get_all_items
155
+ end
156
+
157
+ #
158
+ # Lists all the support tickets for an Azure subscription. You can also filter
159
+ # the support tickets by _Status_ or _CreatedDate_ using the $filter parameter.
160
+ # Output will be a paged result with _nextLink_, using which you can retrieve
161
+ # the next set of support tickets. <br/><br/>Support ticket data is available
162
+ # for 12 months after ticket creation. If a ticket was created more than 12
163
+ # months ago, a request for data might cause an error.
164
+ #
165
+ # @param top [Integer] The number of values to return in the collection.
166
+ # Default is 25 and max is 100.
167
+ # @param filter [String] The filter to apply on the operation. We support
168
+ # 'odata v4.0' filter semantics. [Learn
169
+ # more](https://docs.microsoft.com/odata/concepts/queryoptions-overview).
170
+ # _Status_ filter can only be used with Equals ('eq') operator. For
171
+ # _CreatedDate_ filter, the supported operators are Greater Than ('gt') and
172
+ # Greater Than or Equals ('ge'). When using both filters, combine them using
173
+ # the logical 'AND'.
174
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
175
+ # will be added to the HTTP request.
176
+ #
177
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
178
+ #
179
+ def list_with_http_info(top:nil, filter:nil, custom_headers:nil)
180
+ list_async(top:top, filter:filter, custom_headers:custom_headers).value!
181
+ end
182
+
183
+ #
184
+ # Lists all the support tickets for an Azure subscription. You can also filter
185
+ # the support tickets by _Status_ or _CreatedDate_ using the $filter parameter.
186
+ # Output will be a paged result with _nextLink_, using which you can retrieve
187
+ # the next set of support tickets. <br/><br/>Support ticket data is available
188
+ # for 12 months after ticket creation. If a ticket was created more than 12
189
+ # months ago, a request for data might cause an error.
190
+ #
191
+ # @param top [Integer] The number of values to return in the collection.
192
+ # Default is 25 and max is 100.
193
+ # @param filter [String] The filter to apply on the operation. We support
194
+ # 'odata v4.0' filter semantics. [Learn
195
+ # more](https://docs.microsoft.com/odata/concepts/queryoptions-overview).
196
+ # _Status_ filter can only be used with Equals ('eq') operator. For
197
+ # _CreatedDate_ filter, the supported operators are Greater Than ('gt') and
198
+ # Greater Than or Equals ('ge'). When using both filters, combine them using
199
+ # the logical 'AND'.
200
+ # @param [Hash{String => String}] A hash of custom headers that will be added
201
+ # to the HTTP request.
202
+ #
203
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
204
+ #
205
+ def list_async(top:nil, filter:nil, custom_headers:nil)
206
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
207
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
208
+
209
+
210
+ request_headers = {}
211
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
212
+
213
+ # Set Headers
214
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
215
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
216
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets'
217
+
218
+ request_url = @base_url || @client.base_url
219
+
220
+ options = {
221
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
222
+ path_params: {'subscriptionId' => @client.subscription_id},
223
+ query_params: {'$top' => top,'$filter' => filter,'api-version' => @client.api_version},
224
+ headers: request_headers.merge(custom_headers || {}),
225
+ base_url: request_url
226
+ }
227
+ promise = @client.make_request_async(:get, path_template, options)
228
+
229
+ promise = promise.then do |result|
230
+ http_response = result.response
231
+ status_code = http_response.status
232
+ response_content = http_response.body
233
+ unless status_code == 200
234
+ error_model = JSON.load(response_content)
235
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
236
+ end
237
+
238
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
239
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
240
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
241
+ # Deserialize Response
242
+ if status_code == 200
243
+ begin
244
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
245
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::SupportTicketsListResult.mapper()
246
+ result.body = @client.deserialize(result_mapper, parsed_response)
247
+ rescue Exception => e
248
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
249
+ end
250
+ end
251
+
252
+ result
253
+ end
254
+
255
+ promise.execute
256
+ end
257
+
258
+ #
259
+ # Get ticket details for an Azure subscription. Support ticket data is
260
+ # available for 12 months after ticket creation. If a ticket was created more
261
+ # than 12 months ago, a request for data might cause an error.
262
+ #
263
+ # @param support_ticket_name [String] Support ticket name.
264
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
265
+ # will be added to the HTTP request.
266
+ #
267
+ # @return [SupportTicketDetails] operation results.
268
+ #
269
+ def get(support_ticket_name, custom_headers:nil)
270
+ response = get_async(support_ticket_name, custom_headers:custom_headers).value!
271
+ response.body unless response.nil?
272
+ end
273
+
274
+ #
275
+ # Get ticket details for an Azure subscription. Support ticket data is
276
+ # available for 12 months after ticket creation. If a ticket was created more
277
+ # than 12 months ago, a request for data might cause an error.
278
+ #
279
+ # @param support_ticket_name [String] Support ticket name.
280
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
281
+ # will be added to the HTTP request.
282
+ #
283
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
284
+ #
285
+ def get_with_http_info(support_ticket_name, custom_headers:nil)
286
+ get_async(support_ticket_name, custom_headers:custom_headers).value!
287
+ end
288
+
289
+ #
290
+ # Get ticket details for an Azure subscription. Support ticket data is
291
+ # available for 12 months after ticket creation. If a ticket was created more
292
+ # than 12 months ago, a request for data might cause an error.
293
+ #
294
+ # @param support_ticket_name [String] Support ticket name.
295
+ # @param [Hash{String => String}] A hash of custom headers that will be added
296
+ # to the HTTP request.
297
+ #
298
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
299
+ #
300
+ def get_async(support_ticket_name, custom_headers:nil)
301
+ fail ArgumentError, 'support_ticket_name is nil' if support_ticket_name.nil?
302
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
303
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
304
+
305
+
306
+ request_headers = {}
307
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
308
+
309
+ # Set Headers
310
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
311
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
312
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}'
313
+
314
+ request_url = @base_url || @client.base_url
315
+
316
+ options = {
317
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
318
+ path_params: {'supportTicketName' => support_ticket_name,'subscriptionId' => @client.subscription_id},
319
+ query_params: {'api-version' => @client.api_version},
320
+ headers: request_headers.merge(custom_headers || {}),
321
+ base_url: request_url
322
+ }
323
+ promise = @client.make_request_async(:get, path_template, options)
324
+
325
+ promise = promise.then do |result|
326
+ http_response = result.response
327
+ status_code = http_response.status
328
+ response_content = http_response.body
329
+ unless status_code == 200
330
+ error_model = JSON.load(response_content)
331
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
332
+ end
333
+
334
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
335
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
336
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
337
+ # Deserialize Response
338
+ if status_code == 200
339
+ begin
340
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
341
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::SupportTicketDetails.mapper()
342
+ result.body = @client.deserialize(result_mapper, parsed_response)
343
+ rescue Exception => e
344
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
345
+ end
346
+ end
347
+
348
+ result
349
+ end
350
+
351
+ promise.execute
352
+ end
353
+
354
+ #
355
+ # This API allows you to update the severity level, ticket status, and your
356
+ # contact information in the support ticket.<br/><br/>Note: The severity levels
357
+ # cannot be changed if a support ticket is actively being worked upon by an
358
+ # Azure support engineer. In such a case, contact your support engineer to
359
+ # request severity update by adding a new communication using the
360
+ # Communications API.<br/><br/>Changing the ticket status to _closed_ is
361
+ # allowed only on an unassigned case. When an engineer is actively working on
362
+ # the ticket, send your ticket closure request by sending a note to your
363
+ # engineer.
364
+ #
365
+ # @param support_ticket_name [String] Support ticket name.
366
+ # @param update_support_ticket [UpdateSupportTicket] UpdateSupportTicket
367
+ # object.
368
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
369
+ # will be added to the HTTP request.
370
+ #
371
+ # @return [SupportTicketDetails] operation results.
372
+ #
373
+ def update(support_ticket_name, update_support_ticket, custom_headers:nil)
374
+ response = update_async(support_ticket_name, update_support_ticket, custom_headers:custom_headers).value!
375
+ response.body unless response.nil?
376
+ end
377
+
378
+ #
379
+ # This API allows you to update the severity level, ticket status, and your
380
+ # contact information in the support ticket.<br/><br/>Note: The severity levels
381
+ # cannot be changed if a support ticket is actively being worked upon by an
382
+ # Azure support engineer. In such a case, contact your support engineer to
383
+ # request severity update by adding a new communication using the
384
+ # Communications API.<br/><br/>Changing the ticket status to _closed_ is
385
+ # allowed only on an unassigned case. When an engineer is actively working on
386
+ # the ticket, send your ticket closure request by sending a note to your
387
+ # engineer.
388
+ #
389
+ # @param support_ticket_name [String] Support ticket name.
390
+ # @param update_support_ticket [UpdateSupportTicket] UpdateSupportTicket
391
+ # object.
392
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
393
+ # will be added to the HTTP request.
394
+ #
395
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
396
+ #
397
+ def update_with_http_info(support_ticket_name, update_support_ticket, custom_headers:nil)
398
+ update_async(support_ticket_name, update_support_ticket, custom_headers:custom_headers).value!
399
+ end
400
+
401
+ #
402
+ # This API allows you to update the severity level, ticket status, and your
403
+ # contact information in the support ticket.<br/><br/>Note: The severity levels
404
+ # cannot be changed if a support ticket is actively being worked upon by an
405
+ # Azure support engineer. In such a case, contact your support engineer to
406
+ # request severity update by adding a new communication using the
407
+ # Communications API.<br/><br/>Changing the ticket status to _closed_ is
408
+ # allowed only on an unassigned case. When an engineer is actively working on
409
+ # the ticket, send your ticket closure request by sending a note to your
410
+ # engineer.
411
+ #
412
+ # @param support_ticket_name [String] Support ticket name.
413
+ # @param update_support_ticket [UpdateSupportTicket] UpdateSupportTicket
414
+ # object.
415
+ # @param [Hash{String => String}] A hash of custom headers that will be added
416
+ # to the HTTP request.
417
+ #
418
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
419
+ #
420
+ def update_async(support_ticket_name, update_support_ticket, custom_headers:nil)
421
+ fail ArgumentError, 'support_ticket_name is nil' if support_ticket_name.nil?
422
+ fail ArgumentError, 'update_support_ticket is nil' if update_support_ticket.nil?
423
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
424
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
425
+
426
+
427
+ request_headers = {}
428
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
429
+
430
+ # Set Headers
431
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
432
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
433
+
434
+ # Serialize Request
435
+ request_mapper = Azure::Support::Mgmt::V2020_04_01::Models::UpdateSupportTicket.mapper()
436
+ request_content = @client.serialize(request_mapper, update_support_ticket)
437
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
438
+
439
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}'
440
+
441
+ request_url = @base_url || @client.base_url
442
+
443
+ options = {
444
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
445
+ path_params: {'supportTicketName' => support_ticket_name,'subscriptionId' => @client.subscription_id},
446
+ query_params: {'api-version' => @client.api_version},
447
+ body: request_content,
448
+ headers: request_headers.merge(custom_headers || {}),
449
+ base_url: request_url
450
+ }
451
+ promise = @client.make_request_async(:patch, path_template, options)
452
+
453
+ promise = promise.then do |result|
454
+ http_response = result.response
455
+ status_code = http_response.status
456
+ response_content = http_response.body
457
+ unless status_code == 200
458
+ error_model = JSON.load(response_content)
459
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
460
+ end
461
+
462
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
463
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
464
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
465
+ # Deserialize Response
466
+ if status_code == 200
467
+ begin
468
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
469
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::SupportTicketDetails.mapper()
470
+ result.body = @client.deserialize(result_mapper, parsed_response)
471
+ rescue Exception => e
472
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
473
+ end
474
+ end
475
+
476
+ result
477
+ end
478
+
479
+ promise.execute
480
+ end
481
+
482
+ #
483
+ # Creates a new support ticket for Subscription and Service limits (Quota),
484
+ # Technical, Billing, and Subscription Management issues for the specified
485
+ # subscription. Learn the [prerequisites](https://aka.ms/supportAPI) required
486
+ # to create a support ticket.<br/><br/>Always call the Services and
487
+ # ProblemClassifications API to get the most recent set of services and problem
488
+ # categories required for support ticket creation.<br/><br/>Adding attachments
489
+ # is not currently supported via the API. To add a file to an existing support
490
+ # ticket, visit the [Manage support
491
+ # ticket](https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/managesupportrequest)
492
+ # page in the Azure portal, select the support ticket, and use the file upload
493
+ # control to add a new file.<br/><br/>Providing consent to share diagnostic
494
+ # information with Azure support is currently not supported via the API. The
495
+ # Azure support engineer working on your ticket will reach out to you for
496
+ # consent if your issue requires gathering diagnostic information from your
497
+ # Azure resources.<br/><br/>**Creating a support ticket for on-behalf-of**:
498
+ # Include _x-ms-authorization-auxiliary_ header to provide an auxiliary token
499
+ # as per
500
+ # [documentation](https://docs.microsoft.com/azure/azure-resource-manager/management/authenticate-multi-tenant).
501
+ # The primary token will be from the tenant for whom a support ticket is being
502
+ # raised against the subscription, i.e. Cloud solution provider (CSP) customer
503
+ # tenant. The auxiliary token will be from the Cloud solution provider (CSP)
504
+ # partner tenant.
505
+ #
506
+ # @param support_ticket_name [String] Support ticket name.
507
+ # @param create_support_ticket_parameters [SupportTicketDetails] Support ticket
508
+ # request payload.
509
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
510
+ # will be added to the HTTP request.
511
+ #
512
+ # @return [SupportTicketDetails] operation results.
513
+ #
514
+ def create(support_ticket_name, create_support_ticket_parameters, custom_headers:nil)
515
+ response = create_async(support_ticket_name, create_support_ticket_parameters, custom_headers:custom_headers).value!
516
+ response.body unless response.nil?
517
+ end
518
+
519
+ #
520
+ # @param support_ticket_name [String] Support ticket name.
521
+ # @param create_support_ticket_parameters [SupportTicketDetails] Support ticket
522
+ # request payload.
523
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
524
+ # will be added to the HTTP request.
525
+ #
526
+ # @return [Concurrent::Promise] promise which provides async access to http
527
+ # response.
528
+ #
529
+ def create_async(support_ticket_name, create_support_ticket_parameters, custom_headers:nil)
530
+ # Send request
531
+ promise = begin_create_async(support_ticket_name, create_support_ticket_parameters, custom_headers:custom_headers)
532
+
533
+ promise = promise.then do |response|
534
+ # Defining deserialization method.
535
+ deserialize_method = lambda do |parsed_response|
536
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::SupportTicketDetails.mapper()
537
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
538
+ end
539
+
540
+ # Waiting for response.
541
+ @client.get_long_running_operation_result(response, deserialize_method)
542
+ end
543
+
544
+ promise
545
+ end
546
+
547
+ #
548
+ # Creates a new support ticket for Subscription and Service limits (Quota),
549
+ # Technical, Billing, and Subscription Management issues for the specified
550
+ # subscription. Learn the [prerequisites](https://aka.ms/supportAPI) required
551
+ # to create a support ticket.<br/><br/>Always call the Services and
552
+ # ProblemClassifications API to get the most recent set of services and problem
553
+ # categories required for support ticket creation.<br/><br/>Adding attachments
554
+ # is not currently supported via the API. To add a file to an existing support
555
+ # ticket, visit the [Manage support
556
+ # ticket](https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/managesupportrequest)
557
+ # page in the Azure portal, select the support ticket, and use the file upload
558
+ # control to add a new file.<br/><br/>Providing consent to share diagnostic
559
+ # information with Azure support is currently not supported via the API. The
560
+ # Azure support engineer working on your ticket will reach out to you for
561
+ # consent if your issue requires gathering diagnostic information from your
562
+ # Azure resources.<br/><br/>**Creating a support ticket for on-behalf-of**:
563
+ # Include _x-ms-authorization-auxiliary_ header to provide an auxiliary token
564
+ # as per
565
+ # [documentation](https://docs.microsoft.com/azure/azure-resource-manager/management/authenticate-multi-tenant).
566
+ # The primary token will be from the tenant for whom a support ticket is being
567
+ # raised against the subscription, i.e. Cloud solution provider (CSP) customer
568
+ # tenant. The auxiliary token will be from the Cloud solution provider (CSP)
569
+ # partner tenant.
570
+ #
571
+ # @param support_ticket_name [String] Support ticket name.
572
+ # @param create_support_ticket_parameters [SupportTicketDetails] Support ticket
573
+ # request payload.
574
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
575
+ # will be added to the HTTP request.
576
+ #
577
+ # @return [SupportTicketDetails] operation results.
578
+ #
579
+ def begin_create(support_ticket_name, create_support_ticket_parameters, custom_headers:nil)
580
+ response = begin_create_async(support_ticket_name, create_support_ticket_parameters, custom_headers:custom_headers).value!
581
+ response.body unless response.nil?
582
+ end
583
+
584
+ #
585
+ # Creates a new support ticket for Subscription and Service limits (Quota),
586
+ # Technical, Billing, and Subscription Management issues for the specified
587
+ # subscription. Learn the [prerequisites](https://aka.ms/supportAPI) required
588
+ # to create a support ticket.<br/><br/>Always call the Services and
589
+ # ProblemClassifications API to get the most recent set of services and problem
590
+ # categories required for support ticket creation.<br/><br/>Adding attachments
591
+ # is not currently supported via the API. To add a file to an existing support
592
+ # ticket, visit the [Manage support
593
+ # ticket](https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/managesupportrequest)
594
+ # page in the Azure portal, select the support ticket, and use the file upload
595
+ # control to add a new file.<br/><br/>Providing consent to share diagnostic
596
+ # information with Azure support is currently not supported via the API. The
597
+ # Azure support engineer working on your ticket will reach out to you for
598
+ # consent if your issue requires gathering diagnostic information from your
599
+ # Azure resources.<br/><br/>**Creating a support ticket for on-behalf-of**:
600
+ # Include _x-ms-authorization-auxiliary_ header to provide an auxiliary token
601
+ # as per
602
+ # [documentation](https://docs.microsoft.com/azure/azure-resource-manager/management/authenticate-multi-tenant).
603
+ # The primary token will be from the tenant for whom a support ticket is being
604
+ # raised against the subscription, i.e. Cloud solution provider (CSP) customer
605
+ # tenant. The auxiliary token will be from the Cloud solution provider (CSP)
606
+ # partner tenant.
607
+ #
608
+ # @param support_ticket_name [String] Support ticket name.
609
+ # @param create_support_ticket_parameters [SupportTicketDetails] Support ticket
610
+ # request payload.
611
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
612
+ # will be added to the HTTP request.
613
+ #
614
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
615
+ #
616
+ def begin_create_with_http_info(support_ticket_name, create_support_ticket_parameters, custom_headers:nil)
617
+ begin_create_async(support_ticket_name, create_support_ticket_parameters, custom_headers:custom_headers).value!
618
+ end
619
+
620
+ #
621
+ # Creates a new support ticket for Subscription and Service limits (Quota),
622
+ # Technical, Billing, and Subscription Management issues for the specified
623
+ # subscription. Learn the [prerequisites](https://aka.ms/supportAPI) required
624
+ # to create a support ticket.<br/><br/>Always call the Services and
625
+ # ProblemClassifications API to get the most recent set of services and problem
626
+ # categories required for support ticket creation.<br/><br/>Adding attachments
627
+ # is not currently supported via the API. To add a file to an existing support
628
+ # ticket, visit the [Manage support
629
+ # ticket](https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/managesupportrequest)
630
+ # page in the Azure portal, select the support ticket, and use the file upload
631
+ # control to add a new file.<br/><br/>Providing consent to share diagnostic
632
+ # information with Azure support is currently not supported via the API. The
633
+ # Azure support engineer working on your ticket will reach out to you for
634
+ # consent if your issue requires gathering diagnostic information from your
635
+ # Azure resources.<br/><br/>**Creating a support ticket for on-behalf-of**:
636
+ # Include _x-ms-authorization-auxiliary_ header to provide an auxiliary token
637
+ # as per
638
+ # [documentation](https://docs.microsoft.com/azure/azure-resource-manager/management/authenticate-multi-tenant).
639
+ # The primary token will be from the tenant for whom a support ticket is being
640
+ # raised against the subscription, i.e. Cloud solution provider (CSP) customer
641
+ # tenant. The auxiliary token will be from the Cloud solution provider (CSP)
642
+ # partner tenant.
643
+ #
644
+ # @param support_ticket_name [String] Support ticket name.
645
+ # @param create_support_ticket_parameters [SupportTicketDetails] Support ticket
646
+ # request payload.
647
+ # @param [Hash{String => String}] A hash of custom headers that will be added
648
+ # to the HTTP request.
649
+ #
650
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
651
+ #
652
+ def begin_create_async(support_ticket_name, create_support_ticket_parameters, custom_headers:nil)
653
+ fail ArgumentError, 'support_ticket_name is nil' if support_ticket_name.nil?
654
+ fail ArgumentError, 'create_support_ticket_parameters is nil' if create_support_ticket_parameters.nil?
655
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
656
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
657
+
658
+
659
+ request_headers = {}
660
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
661
+
662
+ # Set Headers
663
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
664
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
665
+
666
+ # Serialize Request
667
+ request_mapper = Azure::Support::Mgmt::V2020_04_01::Models::SupportTicketDetails.mapper()
668
+ request_content = @client.serialize(request_mapper, create_support_ticket_parameters)
669
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
670
+
671
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}'
672
+
673
+ request_url = @base_url || @client.base_url
674
+
675
+ options = {
676
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
677
+ path_params: {'supportTicketName' => support_ticket_name,'subscriptionId' => @client.subscription_id},
678
+ query_params: {'api-version' => @client.api_version},
679
+ body: request_content,
680
+ headers: request_headers.merge(custom_headers || {}),
681
+ base_url: request_url
682
+ }
683
+ promise = @client.make_request_async(:put, path_template, options)
684
+
685
+ promise = promise.then do |result|
686
+ http_response = result.response
687
+ status_code = http_response.status
688
+ response_content = http_response.body
689
+ unless status_code == 200 || status_code == 202
690
+ error_model = JSON.load(response_content)
691
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
692
+ end
693
+
694
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
695
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
696
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
697
+ # Deserialize Response
698
+ if status_code == 200
699
+ begin
700
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
701
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::SupportTicketDetails.mapper()
702
+ result.body = @client.deserialize(result_mapper, parsed_response)
703
+ rescue Exception => e
704
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
705
+ end
706
+ end
707
+
708
+ result
709
+ end
710
+
711
+ promise.execute
712
+ end
713
+
714
+ #
715
+ # Lists all the support tickets for an Azure subscription. You can also filter
716
+ # the support tickets by _Status_ or _CreatedDate_ using the $filter parameter.
717
+ # Output will be a paged result with _nextLink_, using which you can retrieve
718
+ # the next set of support tickets. <br/><br/>Support ticket data is available
719
+ # for 12 months after ticket creation. If a ticket was created more than 12
720
+ # months ago, a request for data might cause an error.
721
+ #
722
+ # @param next_page_link [String] The NextLink from the previous successful call
723
+ # to List operation.
724
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
725
+ # will be added to the HTTP request.
726
+ #
727
+ # @return [SupportTicketsListResult] operation results.
728
+ #
729
+ def list_next(next_page_link, custom_headers:nil)
730
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
731
+ response.body unless response.nil?
732
+ end
733
+
734
+ #
735
+ # Lists all the support tickets for an Azure subscription. You can also filter
736
+ # the support tickets by _Status_ or _CreatedDate_ using the $filter parameter.
737
+ # Output will be a paged result with _nextLink_, using which you can retrieve
738
+ # the next set of support tickets. <br/><br/>Support ticket data is available
739
+ # for 12 months after ticket creation. If a ticket was created more than 12
740
+ # months ago, a request for data might cause an error.
741
+ #
742
+ # @param next_page_link [String] The NextLink from the previous successful call
743
+ # to List operation.
744
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
745
+ # will be added to the HTTP request.
746
+ #
747
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
748
+ #
749
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
750
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
751
+ end
752
+
753
+ #
754
+ # Lists all the support tickets for an Azure subscription. You can also filter
755
+ # the support tickets by _Status_ or _CreatedDate_ using the $filter parameter.
756
+ # Output will be a paged result with _nextLink_, using which you can retrieve
757
+ # the next set of support tickets. <br/><br/>Support ticket data is available
758
+ # for 12 months after ticket creation. If a ticket was created more than 12
759
+ # months ago, a request for data might cause an error.
760
+ #
761
+ # @param next_page_link [String] The NextLink from the previous successful call
762
+ # to List operation.
763
+ # @param [Hash{String => String}] A hash of custom headers that will be added
764
+ # to the HTTP request.
765
+ #
766
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
767
+ #
768
+ def list_next_async(next_page_link, custom_headers:nil)
769
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
770
+
771
+
772
+ request_headers = {}
773
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
774
+
775
+ # Set Headers
776
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
777
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
778
+ path_template = '{nextLink}'
779
+
780
+ request_url = @base_url || @client.base_url
781
+
782
+ options = {
783
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
784
+ skip_encoding_path_params: {'nextLink' => next_page_link},
785
+ headers: request_headers.merge(custom_headers || {}),
786
+ base_url: request_url
787
+ }
788
+ promise = @client.make_request_async(:get, path_template, options)
789
+
790
+ promise = promise.then do |result|
791
+ http_response = result.response
792
+ status_code = http_response.status
793
+ response_content = http_response.body
794
+ unless status_code == 200
795
+ error_model = JSON.load(response_content)
796
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
797
+ end
798
+
799
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
800
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
801
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
802
+ # Deserialize Response
803
+ if status_code == 200
804
+ begin
805
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
806
+ result_mapper = Azure::Support::Mgmt::V2020_04_01::Models::SupportTicketsListResult.mapper()
807
+ result.body = @client.deserialize(result_mapper, parsed_response)
808
+ rescue Exception => e
809
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
810
+ end
811
+ end
812
+
813
+ result
814
+ end
815
+
816
+ promise.execute
817
+ end
818
+
819
+ #
820
+ # Lists all the support tickets for an Azure subscription. You can also filter
821
+ # the support tickets by _Status_ or _CreatedDate_ using the $filter parameter.
822
+ # Output will be a paged result with _nextLink_, using which you can retrieve
823
+ # the next set of support tickets. <br/><br/>Support ticket data is available
824
+ # for 12 months after ticket creation. If a ticket was created more than 12
825
+ # months ago, a request for data might cause an error.
826
+ #
827
+ # @param top [Integer] The number of values to return in the collection.
828
+ # Default is 25 and max is 100.
829
+ # @param filter [String] The filter to apply on the operation. We support
830
+ # 'odata v4.0' filter semantics. [Learn
831
+ # more](https://docs.microsoft.com/odata/concepts/queryoptions-overview).
832
+ # _Status_ filter can only be used with Equals ('eq') operator. For
833
+ # _CreatedDate_ filter, the supported operators are Greater Than ('gt') and
834
+ # Greater Than or Equals ('ge'). When using both filters, combine them using
835
+ # the logical 'AND'.
836
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
837
+ # will be added to the HTTP request.
838
+ #
839
+ # @return [SupportTicketsListResult] which provide lazy access to pages of the
840
+ # response.
841
+ #
842
+ def list_as_lazy(top:nil, filter:nil, custom_headers:nil)
843
+ response = list_async(top:top, filter:filter, custom_headers:custom_headers).value!
844
+ unless response.nil?
845
+ page = response.body
846
+ page.next_method = Proc.new do |next_page_link|
847
+ list_next_async(next_page_link, custom_headers:custom_headers)
848
+ end
849
+ page
850
+ end
851
+ end
852
+
853
+ end
854
+ end