azure_mgmt_notification_hubs 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs.rb +15 -12
  3. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/check_availability_parameters.rb +1 -1
  4. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/check_availability_result.rb +1 -1
  5. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/debug_send_response.rb +128 -0
  6. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/error_response.rb +58 -0
  7. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/namespace_create_or_update_parameters.rb +35 -1
  8. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/namespace_resource.rb +35 -1
  9. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/notification_hub_create_or_update_parameters.rb +1 -1
  10. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/notification_hub_patch_parameters.rb +216 -0
  11. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/notification_hub_resource.rb +1 -1
  12. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/{check_name_availability_request_parameters.rb → operation.rb} +15 -15
  13. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/{check_name_availability_response.rb → operation_display.rb} +22 -21
  14. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/operation_list_result.rb +103 -0
  15. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/pns_credentials_resource.rb +1 -1
  16. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/resource.rb +1 -1
  17. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/shared_access_authorization_rule_create_or_update_parameters.rb +1 -61
  18. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/shared_access_authorization_rule_properties.rb +98 -0
  19. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/models/shared_access_authorization_rule_resource.rb +99 -1
  20. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/namespaces.rb +7 -7
  21. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/notification_hubs.rb +228 -6
  22. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/notification_hubs_management_client.rb +11 -14
  23. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/operations.rb +215 -0
  24. data/lib/profiles/latest/modules/notificationhubs_profile_module.rb +53 -39
  25. data/lib/version.rb +1 -1
  26. metadata +12 -9
  27. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/hubs.rb +0 -131
  28. data/lib/2017-04-01/generated/azure_mgmt_notification_hubs/name.rb +0 -129
@@ -79,7 +79,7 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
79
79
  },
80
80
  location: {
81
81
  client_side_validation: true,
82
- required: true,
82
+ required: false,
83
83
  serialized_name: 'location',
84
84
  type: {
85
85
  name: 'String'
@@ -74,7 +74,7 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
74
74
  },
75
75
  location: {
76
76
  client_side_validation: true,
77
- required: true,
77
+ required: false,
78
78
  serialized_name: 'location',
79
79
  type: {
80
80
  name: 'String'
@@ -8,7 +8,7 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
8
8
  #
9
9
  # Parameters supplied to the CreateOrUpdate Namespace AuthorizationRules.
10
10
  #
11
- class SharedAccessAuthorizationRuleCreateOrUpdateParameters < Resource
11
+ class SharedAccessAuthorizationRuleCreateOrUpdateParameters
12
12
 
13
13
  include MsRestAzure
14
14
 
@@ -31,66 +31,6 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
31
31
  name: 'Composite',
32
32
  class_name: 'SharedAccessAuthorizationRuleCreateOrUpdateParameters',
33
33
  model_properties: {
34
- id: {
35
- client_side_validation: true,
36
- required: false,
37
- read_only: true,
38
- serialized_name: 'id',
39
- type: {
40
- name: 'String'
41
- }
42
- },
43
- name: {
44
- client_side_validation: true,
45
- required: false,
46
- read_only: true,
47
- serialized_name: 'name',
48
- type: {
49
- name: 'String'
50
- }
51
- },
52
- type: {
53
- client_side_validation: true,
54
- required: false,
55
- read_only: true,
56
- serialized_name: 'type',
57
- type: {
58
- name: 'String'
59
- }
60
- },
61
- location: {
62
- client_side_validation: true,
63
- required: true,
64
- serialized_name: 'location',
65
- type: {
66
- name: 'String'
67
- }
68
- },
69
- tags: {
70
- client_side_validation: true,
71
- required: false,
72
- serialized_name: 'tags',
73
- type: {
74
- name: 'Dictionary',
75
- value: {
76
- client_side_validation: true,
77
- required: false,
78
- serialized_name: 'StringElementType',
79
- type: {
80
- name: 'String'
81
- }
82
- }
83
- }
84
- },
85
- sku: {
86
- client_side_validation: true,
87
- required: false,
88
- serialized_name: 'sku',
89
- type: {
90
- name: 'Composite',
91
- class_name: 'Sku'
92
- }
93
- },
94
34
  properties: {
95
35
  client_side_validation: true,
96
36
  required: true,
@@ -15,6 +15,32 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
15
15
  # @return [Array<AccessRights>] The rights associated with the rule.
16
16
  attr_accessor :rights
17
17
 
18
+ # @return [String] A base64-encoded 256-bit primary key for signing and
19
+ # validating the SAS token.
20
+ attr_accessor :primary_key
21
+
22
+ # @return [String] A base64-encoded 256-bit primary key for signing and
23
+ # validating the SAS token.
24
+ attr_accessor :secondary_key
25
+
26
+ # @return [String] A string that describes the authorization rule.
27
+ attr_accessor :key_name
28
+
29
+ # @return [String] A string that describes the claim type
30
+ attr_accessor :claim_type
31
+
32
+ # @return [String] A string that describes the claim value
33
+ attr_accessor :claim_value
34
+
35
+ # @return [String] The last modified time for this rule
36
+ attr_accessor :modified_time
37
+
38
+ # @return [String] The created time for this rule
39
+ attr_accessor :created_time
40
+
41
+ # @return [Integer] The revision number for the rule
42
+ attr_accessor :revision
43
+
18
44
 
19
45
  #
20
46
  # Mapper for SharedAccessAuthorizationRuleProperties class as Ruby Hash.
@@ -45,6 +71,78 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
45
71
  }
46
72
  }
47
73
  }
74
+ },
75
+ primary_key: {
76
+ client_side_validation: true,
77
+ required: false,
78
+ read_only: true,
79
+ serialized_name: 'primaryKey',
80
+ type: {
81
+ name: 'String'
82
+ }
83
+ },
84
+ secondary_key: {
85
+ client_side_validation: true,
86
+ required: false,
87
+ read_only: true,
88
+ serialized_name: 'secondaryKey',
89
+ type: {
90
+ name: 'String'
91
+ }
92
+ },
93
+ key_name: {
94
+ client_side_validation: true,
95
+ required: false,
96
+ read_only: true,
97
+ serialized_name: 'keyName',
98
+ type: {
99
+ name: 'String'
100
+ }
101
+ },
102
+ claim_type: {
103
+ client_side_validation: true,
104
+ required: false,
105
+ read_only: true,
106
+ serialized_name: 'claimType',
107
+ type: {
108
+ name: 'String'
109
+ }
110
+ },
111
+ claim_value: {
112
+ client_side_validation: true,
113
+ required: false,
114
+ read_only: true,
115
+ serialized_name: 'claimValue',
116
+ type: {
117
+ name: 'String'
118
+ }
119
+ },
120
+ modified_time: {
121
+ client_side_validation: true,
122
+ required: false,
123
+ read_only: true,
124
+ serialized_name: 'modifiedTime',
125
+ type: {
126
+ name: 'String'
127
+ }
128
+ },
129
+ created_time: {
130
+ client_side_validation: true,
131
+ required: false,
132
+ read_only: true,
133
+ serialized_name: 'createdTime',
134
+ type: {
135
+ name: 'String'
136
+ }
137
+ },
138
+ revision: {
139
+ client_side_validation: true,
140
+ required: false,
141
+ read_only: true,
142
+ serialized_name: 'revision',
143
+ type: {
144
+ name: 'Number'
145
+ }
48
146
  }
49
147
  }
50
148
  }
@@ -15,6 +15,32 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
15
15
  # @return [Array<AccessRights>] The rights associated with the rule.
16
16
  attr_accessor :rights
17
17
 
18
+ # @return [String] A base64-encoded 256-bit primary key for signing and
19
+ # validating the SAS token.
20
+ attr_accessor :primary_key
21
+
22
+ # @return [String] A base64-encoded 256-bit primary key for signing and
23
+ # validating the SAS token.
24
+ attr_accessor :secondary_key
25
+
26
+ # @return [String] A string that describes the authorization rule.
27
+ attr_accessor :key_name
28
+
29
+ # @return [String] A string that describes the claim type
30
+ attr_accessor :claim_type
31
+
32
+ # @return [String] A string that describes the claim value
33
+ attr_accessor :claim_value
34
+
35
+ # @return [String] The last modified time for this rule
36
+ attr_accessor :modified_time
37
+
38
+ # @return [String] The created time for this rule
39
+ attr_accessor :created_time
40
+
41
+ # @return [Integer] The revision number for the rule
42
+ attr_accessor :revision
43
+
18
44
 
19
45
  #
20
46
  # Mapper for SharedAccessAuthorizationRuleResource class as Ruby Hash.
@@ -58,7 +84,7 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
58
84
  },
59
85
  location: {
60
86
  client_side_validation: true,
61
- required: true,
87
+ required: false,
62
88
  serialized_name: 'location',
63
89
  type: {
64
90
  name: 'String'
@@ -105,6 +131,78 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
105
131
  }
106
132
  }
107
133
  }
134
+ },
135
+ primary_key: {
136
+ client_side_validation: true,
137
+ required: false,
138
+ read_only: true,
139
+ serialized_name: 'properties.primaryKey',
140
+ type: {
141
+ name: 'String'
142
+ }
143
+ },
144
+ secondary_key: {
145
+ client_side_validation: true,
146
+ required: false,
147
+ read_only: true,
148
+ serialized_name: 'properties.secondaryKey',
149
+ type: {
150
+ name: 'String'
151
+ }
152
+ },
153
+ key_name: {
154
+ client_side_validation: true,
155
+ required: false,
156
+ read_only: true,
157
+ serialized_name: 'properties.keyName',
158
+ type: {
159
+ name: 'String'
160
+ }
161
+ },
162
+ claim_type: {
163
+ client_side_validation: true,
164
+ required: false,
165
+ read_only: true,
166
+ serialized_name: 'properties.claimType',
167
+ type: {
168
+ name: 'String'
169
+ }
170
+ },
171
+ claim_value: {
172
+ client_side_validation: true,
173
+ required: false,
174
+ read_only: true,
175
+ serialized_name: 'properties.claimValue',
176
+ type: {
177
+ name: 'String'
178
+ }
179
+ },
180
+ modified_time: {
181
+ client_side_validation: true,
182
+ required: false,
183
+ read_only: true,
184
+ serialized_name: 'properties.modifiedTime',
185
+ type: {
186
+ name: 'String'
187
+ }
188
+ },
189
+ created_time: {
190
+ client_side_validation: true,
191
+ required: false,
192
+ read_only: true,
193
+ serialized_name: 'properties.createdTime',
194
+ type: {
195
+ name: 'String'
196
+ }
197
+ },
198
+ revision: {
199
+ client_side_validation: true,
200
+ required: false,
201
+ read_only: true,
202
+ serialized_name: 'properties.revision',
203
+ type: {
204
+ name: 'Number'
205
+ }
108
206
  }
109
207
  }
110
208
  }
@@ -208,14 +208,14 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
208
208
  http_response = result.response
209
209
  status_code = http_response.status
210
210
  response_content = http_response.body
211
- unless status_code == 201 || status_code == 200
211
+ unless status_code == 200 || status_code == 201
212
212
  error_model = JSON.load(response_content)
213
213
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
214
214
  end
215
215
 
216
216
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
217
217
  # Deserialize Response
218
- if status_code == 201
218
+ if status_code == 200
219
219
  begin
220
220
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
221
221
  result_mapper = Azure::NotificationHubs::Mgmt::V2017_04_01::Models::NamespaceResource.mapper()
@@ -225,7 +225,7 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
225
225
  end
226
226
  end
227
227
  # Deserialize Response
228
- if status_code == 200
228
+ if status_code == 201
229
229
  begin
230
230
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
231
231
  result_mapper = Azure::NotificationHubs::Mgmt::V2017_04_01::Models::NamespaceResource.mapper()
@@ -660,7 +660,7 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
660
660
  http_response = result.response
661
661
  status_code = http_response.status
662
662
  response_content = http_response.body
663
- unless status_code == 204 || status_code == 200
663
+ unless status_code == 200 || status_code == 204
664
664
  error_model = JSON.load(response_content)
665
665
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
666
666
  end
@@ -1052,7 +1052,7 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
1052
1052
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1053
1053
  # will be added to the HTTP request.
1054
1054
  #
1055
- # @return [ResourceListKeys] operation results.
1055
+ # @return [SharedAccessAuthorizationRuleListResult] operation results.
1056
1056
  #
1057
1057
  def list_keys(resource_group_name, namespace_name, authorization_rule_name, custom_headers:nil)
1058
1058
  response = list_keys_async(resource_group_name, namespace_name, authorization_rule_name, custom_headers:custom_headers).value!
@@ -1128,7 +1128,7 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
1128
1128
  if status_code == 200
1129
1129
  begin
1130
1130
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1131
- result_mapper = Azure::NotificationHubs::Mgmt::V2017_04_01::Models::ResourceListKeys.mapper()
1131
+ result_mapper = Azure::NotificationHubs::Mgmt::V2017_04_01::Models::SharedAccessAuthorizationRuleListResult.mapper()
1132
1132
  result.body = @client.deserialize(result_mapper, parsed_response)
1133
1133
  rescue Exception => e
1134
1134
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -1325,7 +1325,7 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
1325
1325
  http_response = result.response
1326
1326
  status_code = http_response.status
1327
1327
  response_content = http_response.body
1328
- unless status_code == 204 || status_code == 200 || status_code == 202
1328
+ unless status_code == 200 || status_code == 202 || status_code == 204
1329
1329
  error_model = JSON.load(response_content)
1330
1330
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1331
1331
  end
@@ -32,8 +32,8 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
32
32
  #
33
33
  # @return [CheckAvailabilityResult] operation results.
34
34
  #
35
- def check_availability(resource_group_name, namespace_name, parameters, custom_headers:nil)
36
- response = check_availability_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
35
+ def check_notification_hub_availability(resource_group_name, namespace_name, parameters, custom_headers:nil)
36
+ response = check_notification_hub_availability_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
37
37
  response.body unless response.nil?
38
38
  end
39
39
 
@@ -48,8 +48,8 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
48
48
  #
49
49
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
50
  #
51
- def check_availability_with_http_info(resource_group_name, namespace_name, parameters, custom_headers:nil)
52
- check_availability_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
51
+ def check_notification_hub_availability_with_http_info(resource_group_name, namespace_name, parameters, custom_headers:nil)
52
+ check_notification_hub_availability_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
53
53
  end
54
54
 
55
55
  #
@@ -63,7 +63,7 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
63
63
  #
64
64
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
65
  #
66
- def check_availability_async(resource_group_name, namespace_name, parameters, custom_headers:nil)
66
+ def check_notification_hub_availability_async(resource_group_name, namespace_name, parameters, custom_headers:nil)
67
67
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
68
68
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
69
69
  fail ArgumentError, 'parameters is nil' if parameters.nil?
@@ -244,6 +244,115 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
244
244
  promise.execute
245
245
  end
246
246
 
247
+ #
248
+ # Patch a NotificationHub in a namespace.
249
+ #
250
+ # @param resource_group_name [String] The name of the resource group.
251
+ # @param namespace_name [String] The namespace name.
252
+ # @param notification_hub_name [String] The notification hub name.
253
+ # @param parameters [NotificationHubPatchParameters] Parameters supplied to
254
+ # patch a NotificationHub Resource.
255
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
256
+ # will be added to the HTTP request.
257
+ #
258
+ # @return [NotificationHubResource] operation results.
259
+ #
260
+ def patch(resource_group_name, namespace_name, notification_hub_name, parameters:nil, custom_headers:nil)
261
+ response = patch_async(resource_group_name, namespace_name, notification_hub_name, parameters:parameters, custom_headers:custom_headers).value!
262
+ response.body unless response.nil?
263
+ end
264
+
265
+ #
266
+ # Patch a NotificationHub in a namespace.
267
+ #
268
+ # @param resource_group_name [String] The name of the resource group.
269
+ # @param namespace_name [String] The namespace name.
270
+ # @param notification_hub_name [String] The notification hub name.
271
+ # @param parameters [NotificationHubPatchParameters] Parameters supplied to
272
+ # patch a NotificationHub Resource.
273
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
274
+ # will be added to the HTTP request.
275
+ #
276
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
277
+ #
278
+ def patch_with_http_info(resource_group_name, namespace_name, notification_hub_name, parameters:nil, custom_headers:nil)
279
+ patch_async(resource_group_name, namespace_name, notification_hub_name, parameters:parameters, custom_headers:custom_headers).value!
280
+ end
281
+
282
+ #
283
+ # Patch a NotificationHub in a namespace.
284
+ #
285
+ # @param resource_group_name [String] The name of the resource group.
286
+ # @param namespace_name [String] The namespace name.
287
+ # @param notification_hub_name [String] The notification hub name.
288
+ # @param parameters [NotificationHubPatchParameters] Parameters supplied to
289
+ # patch a NotificationHub Resource.
290
+ # @param [Hash{String => String}] A hash of custom headers that will be added
291
+ # to the HTTP request.
292
+ #
293
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
294
+ #
295
+ def patch_async(resource_group_name, namespace_name, notification_hub_name, parameters:nil, custom_headers:nil)
296
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
297
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
298
+ fail ArgumentError, 'notification_hub_name is nil' if notification_hub_name.nil?
299
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
300
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
301
+
302
+
303
+ request_headers = {}
304
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
305
+
306
+ # Set Headers
307
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
308
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
309
+
310
+ # Serialize Request
311
+ request_mapper = Azure::NotificationHubs::Mgmt::V2017_04_01::Models::NotificationHubPatchParameters.mapper()
312
+ request_content = @client.serialize(request_mapper, parameters)
313
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
314
+
315
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}'
316
+
317
+ request_url = @base_url || @client.base_url
318
+
319
+ options = {
320
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
321
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'notificationHubName' => notification_hub_name,'subscriptionId' => @client.subscription_id},
322
+ query_params: {'api-version' => @client.api_version},
323
+ body: request_content,
324
+ headers: request_headers.merge(custom_headers || {}),
325
+ base_url: request_url
326
+ }
327
+ promise = @client.make_request_async(:patch, path_template, options)
328
+
329
+ promise = promise.then do |result|
330
+ http_response = result.response
331
+ status_code = http_response.status
332
+ response_content = http_response.body
333
+ unless status_code == 200
334
+ error_model = JSON.load(response_content)
335
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
336
+ end
337
+
338
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
339
+ # Deserialize Response
340
+ if status_code == 200
341
+ begin
342
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
343
+ result_mapper = Azure::NotificationHubs::Mgmt::V2017_04_01::Models::NotificationHubResource.mapper()
344
+ result.body = @client.deserialize(result_mapper, parsed_response)
345
+ rescue Exception => e
346
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
347
+ end
348
+ end
349
+
350
+ result
351
+ end
352
+
353
+ promise.execute
354
+ end
355
+
247
356
  #
248
357
  # Deletes a notification hub associated with a namespace.
249
358
  #
@@ -425,6 +534,119 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
425
534
  promise.execute
426
535
  end
427
536
 
537
+ #
538
+ # test send a push notification
539
+ #
540
+ # @param resource_group_name [String] The name of the resource group.
541
+ # @param namespace_name [String] The namespace name.
542
+ # @param notification_hub_name [String] The notification hub name.
543
+ # @param parameters Debug send parameters
544
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
545
+ # will be added to the HTTP request.
546
+ #
547
+ # @return [DebugSendResponse] operation results.
548
+ #
549
+ def debug_send(resource_group_name, namespace_name, notification_hub_name, parameters:nil, custom_headers:nil)
550
+ response = debug_send_async(resource_group_name, namespace_name, notification_hub_name, parameters:parameters, custom_headers:custom_headers).value!
551
+ response.body unless response.nil?
552
+ end
553
+
554
+ #
555
+ # test send a push notification
556
+ #
557
+ # @param resource_group_name [String] The name of the resource group.
558
+ # @param namespace_name [String] The namespace name.
559
+ # @param notification_hub_name [String] The notification hub name.
560
+ # @param parameters Debug send parameters
561
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
562
+ # will be added to the HTTP request.
563
+ #
564
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
565
+ #
566
+ def debug_send_with_http_info(resource_group_name, namespace_name, notification_hub_name, parameters:nil, custom_headers:nil)
567
+ debug_send_async(resource_group_name, namespace_name, notification_hub_name, parameters:parameters, custom_headers:custom_headers).value!
568
+ end
569
+
570
+ #
571
+ # test send a push notification
572
+ #
573
+ # @param resource_group_name [String] The name of the resource group.
574
+ # @param namespace_name [String] The namespace name.
575
+ # @param notification_hub_name [String] The notification hub name.
576
+ # @param parameters Debug send parameters
577
+ # @param [Hash{String => String}] A hash of custom headers that will be added
578
+ # to the HTTP request.
579
+ #
580
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
581
+ #
582
+ def debug_send_async(resource_group_name, namespace_name, notification_hub_name, parameters:nil, custom_headers:nil)
583
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
584
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
585
+ fail ArgumentError, 'notification_hub_name is nil' if notification_hub_name.nil?
586
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
587
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
588
+
589
+
590
+ request_headers = {}
591
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
592
+
593
+ # Set Headers
594
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
595
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
596
+
597
+ # Serialize Request
598
+ request_mapper = {
599
+ client_side_validation: true,
600
+ required: false,
601
+ serialized_name: 'parameters',
602
+ type: {
603
+ name: 'Object'
604
+ }
605
+ }
606
+ request_content = @client.serialize(request_mapper, parameters)
607
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
608
+
609
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/debugsend'
610
+
611
+ request_url = @base_url || @client.base_url
612
+
613
+ options = {
614
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
615
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'notificationHubName' => notification_hub_name,'subscriptionId' => @client.subscription_id},
616
+ query_params: {'api-version' => @client.api_version},
617
+ body: request_content,
618
+ headers: request_headers.merge(custom_headers || {}),
619
+ base_url: request_url
620
+ }
621
+ promise = @client.make_request_async(:post, path_template, options)
622
+
623
+ promise = promise.then do |result|
624
+ http_response = result.response
625
+ status_code = http_response.status
626
+ response_content = http_response.body
627
+ unless status_code == 201
628
+ error_model = JSON.load(response_content)
629
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
630
+ end
631
+
632
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
633
+ # Deserialize Response
634
+ if status_code == 201
635
+ begin
636
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
637
+ result_mapper = Azure::NotificationHubs::Mgmt::V2017_04_01::Models::DebugSendResponse.mapper()
638
+ result.body = @client.deserialize(result_mapper, parsed_response)
639
+ rescue Exception => e
640
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
641
+ end
642
+ end
643
+
644
+ result
645
+ end
646
+
647
+ promise.execute
648
+ end
649
+
428
650
  #
429
651
  # Creates/Updates an authorization rule for a NotificationHub
430
652
  #
@@ -615,7 +837,7 @@ module Azure::NotificationHubs::Mgmt::V2017_04_01
615
837
  http_response = result.response
616
838
  status_code = http_response.status
617
839
  response_content = http_response.body
618
- unless status_code == 204 || status_code == 200
840
+ unless status_code == 200 || status_code == 204
619
841
  error_model = JSON.load(response_content)
620
842
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
621
843
  end