1package notificationhubs
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"context"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/azure"
24	"github.com/Azure/go-autorest/autorest/validation"
25	"github.com/Azure/go-autorest/tracing"
26	"net/http"
27)
28
29// Client is the azure NotificationHub client
30type Client struct {
31	BaseClient
32}
33
34// NewClient creates an instance of the Client client.
35func NewClient(subscriptionID string) Client {
36	return NewClientWithBaseURI(DefaultBaseURI, subscriptionID)
37}
38
39// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint.  Use this when interacting
40// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
41func NewClientWithBaseURI(baseURI string, subscriptionID string) Client {
42	return Client{NewWithBaseURI(baseURI, subscriptionID)}
43}
44
45// CheckAvailability checks the availability of the given notificationHub in a namespace.
46// Parameters:
47// resourceGroupName - the name of the resource group.
48// namespaceName - the namespace name.
49// parameters - the notificationHub name.
50func (client Client) CheckAvailability(ctx context.Context, resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (result CheckAvailabilityResult, err error) {
51	if tracing.IsEnabled() {
52		ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckAvailability")
53		defer func() {
54			sc := -1
55			if result.Response.Response != nil {
56				sc = result.Response.Response.StatusCode
57			}
58			tracing.EndSpan(ctx, sc, err)
59		}()
60	}
61	if err := validation.Validate([]validation.Validation{
62		{TargetValue: parameters,
63			Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil},
64				{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
65		return result, validation.NewError("notificationhubs.Client", "CheckAvailability", err.Error())
66	}
67
68	req, err := client.CheckAvailabilityPreparer(ctx, resourceGroupName, namespaceName, parameters)
69	if err != nil {
70		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CheckAvailability", nil, "Failure preparing request")
71		return
72	}
73
74	resp, err := client.CheckAvailabilitySender(req)
75	if err != nil {
76		result.Response = autorest.Response{Response: resp}
77		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CheckAvailability", resp, "Failure sending request")
78		return
79	}
80
81	result, err = client.CheckAvailabilityResponder(resp)
82	if err != nil {
83		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CheckAvailability", resp, "Failure responding to request")
84	}
85
86	return
87}
88
89// CheckAvailabilityPreparer prepares the CheckAvailability request.
90func (client Client) CheckAvailabilityPreparer(ctx context.Context, resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (*http.Request, error) {
91	pathParameters := map[string]interface{}{
92		"namespaceName":     autorest.Encode("path", namespaceName),
93		"resourceGroupName": autorest.Encode("path", resourceGroupName),
94		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
95	}
96
97	const APIVersion = "2016-03-01"
98	queryParameters := map[string]interface{}{
99		"api-version": APIVersion,
100	}
101
102	parameters.ID = nil
103	parameters.Type = nil
104	preparer := autorest.CreatePreparer(
105		autorest.AsContentType("application/json; charset=utf-8"),
106		autorest.AsPost(),
107		autorest.WithBaseURL(client.BaseURI),
108		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability", pathParameters),
109		autorest.WithJSON(parameters),
110		autorest.WithQueryParameters(queryParameters))
111	return preparer.Prepare((&http.Request{}).WithContext(ctx))
112}
113
114// CheckAvailabilitySender sends the CheckAvailability request. The method will close the
115// http.Response Body if it receives an error.
116func (client Client) CheckAvailabilitySender(req *http.Request) (*http.Response, error) {
117	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
118}
119
120// CheckAvailabilityResponder handles the response to the CheckAvailability request. The method always
121// closes the http.Response Body.
122func (client Client) CheckAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResult, err error) {
123	err = autorest.Respond(
124		resp,
125		client.ByInspecting(),
126		azure.WithErrorUnlessStatusCode(http.StatusOK),
127		autorest.ByUnmarshallingJSON(&result),
128		autorest.ByClosing())
129	result.Response = autorest.Response{Response: resp}
130	return
131}
132
133// CreateOrUpdate creates/Update a NotificationHub in a namespace.
134// Parameters:
135// resourceGroupName - the name of the resource group.
136// namespaceName - the namespace name.
137// notificationHubName - the notification hub name.
138// parameters - parameters supplied to the create/update a NotificationHub Resource.
139func (client Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, parameters CreateOrUpdateParameters) (result ResourceType, err error) {
140	if tracing.IsEnabled() {
141		ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdate")
142		defer func() {
143			sc := -1
144			if result.Response.Response != nil {
145				sc = result.Response.Response.StatusCode
146			}
147			tracing.EndSpan(ctx, sc, err)
148		}()
149	}
150	if err := validation.Validate([]validation.Validation{
151		{TargetValue: parameters,
152			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
153		return result, validation.NewError("notificationhubs.Client", "CreateOrUpdate", err.Error())
154	}
155
156	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, notificationHubName, parameters)
157	if err != nil {
158		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdate", nil, "Failure preparing request")
159		return
160	}
161
162	resp, err := client.CreateOrUpdateSender(req)
163	if err != nil {
164		result.Response = autorest.Response{Response: resp}
165		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdate", resp, "Failure sending request")
166		return
167	}
168
169	result, err = client.CreateOrUpdateResponder(resp)
170	if err != nil {
171		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdate", resp, "Failure responding to request")
172	}
173
174	return
175}
176
177// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
178func (client Client) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, parameters CreateOrUpdateParameters) (*http.Request, error) {
179	pathParameters := map[string]interface{}{
180		"namespaceName":       autorest.Encode("path", namespaceName),
181		"notificationHubName": autorest.Encode("path", notificationHubName),
182		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
183		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
184	}
185
186	const APIVersion = "2016-03-01"
187	queryParameters := map[string]interface{}{
188		"api-version": APIVersion,
189	}
190
191	preparer := autorest.CreatePreparer(
192		autorest.AsContentType("application/json; charset=utf-8"),
193		autorest.AsPut(),
194		autorest.WithBaseURL(client.BaseURI),
195		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters),
196		autorest.WithJSON(parameters),
197		autorest.WithQueryParameters(queryParameters))
198	return preparer.Prepare((&http.Request{}).WithContext(ctx))
199}
200
201// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
202// http.Response Body if it receives an error.
203func (client Client) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
204	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
205}
206
207// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
208// closes the http.Response Body.
209func (client Client) CreateOrUpdateResponder(resp *http.Response) (result ResourceType, err error) {
210	err = autorest.Respond(
211		resp,
212		client.ByInspecting(),
213		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
214		autorest.ByUnmarshallingJSON(&result),
215		autorest.ByClosing())
216	result.Response = autorest.Response{Response: resp}
217	return
218}
219
220// CreateOrUpdateAuthorizationRule creates/Updates an authorization rule for a NotificationHub
221// Parameters:
222// resourceGroupName - the name of the resource group.
223// namespaceName - the namespace name.
224// notificationHubName - the notification hub name.
225// authorizationRuleName - authorization Rule Name.
226// parameters - the shared access authorization rule.
227func (client Client) CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) {
228	if tracing.IsEnabled() {
229		ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdateAuthorizationRule")
230		defer func() {
231			sc := -1
232			if result.Response.Response != nil {
233				sc = result.Response.Response.StatusCode
234			}
235			tracing.EndSpan(ctx, sc, err)
236		}()
237	}
238	if err := validation.Validate([]validation.Validation{
239		{TargetValue: parameters,
240			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
241		return result, validation.NewError("notificationhubs.Client", "CreateOrUpdateAuthorizationRule", err.Error())
242	}
243
244	req, err := client.CreateOrUpdateAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters)
245	if err != nil {
246		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request")
247		return
248	}
249
250	resp, err := client.CreateOrUpdateAuthorizationRuleSender(req)
251	if err != nil {
252		result.Response = autorest.Response{Response: resp}
253		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request")
254		return
255	}
256
257	result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp)
258	if err != nil {
259		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request")
260	}
261
262	return
263}
264
265// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request.
266func (client Client) CreateOrUpdateAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) {
267	pathParameters := map[string]interface{}{
268		"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
269		"namespaceName":         autorest.Encode("path", namespaceName),
270		"notificationHubName":   autorest.Encode("path", notificationHubName),
271		"resourceGroupName":     autorest.Encode("path", resourceGroupName),
272		"subscriptionId":        autorest.Encode("path", client.SubscriptionID),
273	}
274
275	const APIVersion = "2016-03-01"
276	queryParameters := map[string]interface{}{
277		"api-version": APIVersion,
278	}
279
280	preparer := autorest.CreatePreparer(
281		autorest.AsContentType("application/json; charset=utf-8"),
282		autorest.AsPut(),
283		autorest.WithBaseURL(client.BaseURI),
284		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters),
285		autorest.WithJSON(parameters),
286		autorest.WithQueryParameters(queryParameters))
287	return preparer.Prepare((&http.Request{}).WithContext(ctx))
288}
289
290// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the
291// http.Response Body if it receives an error.
292func (client Client) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) {
293	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
294}
295
296// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always
297// closes the http.Response Body.
298func (client Client) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) {
299	err = autorest.Respond(
300		resp,
301		client.ByInspecting(),
302		azure.WithErrorUnlessStatusCode(http.StatusOK),
303		autorest.ByUnmarshallingJSON(&result),
304		autorest.ByClosing())
305	result.Response = autorest.Response{Response: resp}
306	return
307}
308
309// Delete deletes a notification hub associated with a namespace.
310// Parameters:
311// resourceGroupName - the name of the resource group.
312// namespaceName - the namespace name.
313// notificationHubName - the notification hub name.
314func (client Client) Delete(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (result autorest.Response, err error) {
315	if tracing.IsEnabled() {
316		ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete")
317		defer func() {
318			sc := -1
319			if result.Response != nil {
320				sc = result.Response.StatusCode
321			}
322			tracing.EndSpan(ctx, sc, err)
323		}()
324	}
325	req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, notificationHubName)
326	if err != nil {
327		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Delete", nil, "Failure preparing request")
328		return
329	}
330
331	resp, err := client.DeleteSender(req)
332	if err != nil {
333		result.Response = resp
334		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Delete", resp, "Failure sending request")
335		return
336	}
337
338	result, err = client.DeleteResponder(resp)
339	if err != nil {
340		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Delete", resp, "Failure responding to request")
341	}
342
343	return
344}
345
346// DeletePreparer prepares the Delete request.
347func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) {
348	pathParameters := map[string]interface{}{
349		"namespaceName":       autorest.Encode("path", namespaceName),
350		"notificationHubName": autorest.Encode("path", notificationHubName),
351		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
352		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
353	}
354
355	const APIVersion = "2016-03-01"
356	queryParameters := map[string]interface{}{
357		"api-version": APIVersion,
358	}
359
360	preparer := autorest.CreatePreparer(
361		autorest.AsDelete(),
362		autorest.WithBaseURL(client.BaseURI),
363		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters),
364		autorest.WithQueryParameters(queryParameters))
365	return preparer.Prepare((&http.Request{}).WithContext(ctx))
366}
367
368// DeleteSender sends the Delete request. The method will close the
369// http.Response Body if it receives an error.
370func (client Client) DeleteSender(req *http.Request) (*http.Response, error) {
371	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
372}
373
374// DeleteResponder handles the response to the Delete request. The method always
375// closes the http.Response Body.
376func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
377	err = autorest.Respond(
378		resp,
379		client.ByInspecting(),
380		azure.WithErrorUnlessStatusCode(http.StatusOK),
381		autorest.ByClosing())
382	result.Response = resp
383	return
384}
385
386// DeleteAuthorizationRule deletes a notificationHub authorization rule
387// Parameters:
388// resourceGroupName - the name of the resource group.
389// namespaceName - the namespace name.
390// notificationHubName - the notification hub name.
391// authorizationRuleName - authorization Rule Name.
392func (client Client) DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result autorest.Response, err error) {
393	if tracing.IsEnabled() {
394		ctx = tracing.StartSpan(ctx, fqdn+"/Client.DeleteAuthorizationRule")
395		defer func() {
396			sc := -1
397			if result.Response != nil {
398				sc = result.Response.StatusCode
399			}
400			tracing.EndSpan(ctx, sc, err)
401		}()
402	}
403	req, err := client.DeleteAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName)
404	if err != nil {
405		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "DeleteAuthorizationRule", nil, "Failure preparing request")
406		return
407	}
408
409	resp, err := client.DeleteAuthorizationRuleSender(req)
410	if err != nil {
411		result.Response = resp
412		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "DeleteAuthorizationRule", resp, "Failure sending request")
413		return
414	}
415
416	result, err = client.DeleteAuthorizationRuleResponder(resp)
417	if err != nil {
418		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "DeleteAuthorizationRule", resp, "Failure responding to request")
419	}
420
421	return
422}
423
424// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request.
425func (client Client) DeleteAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) {
426	pathParameters := map[string]interface{}{
427		"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
428		"namespaceName":         autorest.Encode("path", namespaceName),
429		"notificationHubName":   autorest.Encode("path", notificationHubName),
430		"resourceGroupName":     autorest.Encode("path", resourceGroupName),
431		"subscriptionId":        autorest.Encode("path", client.SubscriptionID),
432	}
433
434	const APIVersion = "2016-03-01"
435	queryParameters := map[string]interface{}{
436		"api-version": APIVersion,
437	}
438
439	preparer := autorest.CreatePreparer(
440		autorest.AsDelete(),
441		autorest.WithBaseURL(client.BaseURI),
442		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters),
443		autorest.WithQueryParameters(queryParameters))
444	return preparer.Prepare((&http.Request{}).WithContext(ctx))
445}
446
447// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the
448// http.Response Body if it receives an error.
449func (client Client) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) {
450	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
451}
452
453// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always
454// closes the http.Response Body.
455func (client Client) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) {
456	err = autorest.Respond(
457		resp,
458		client.ByInspecting(),
459		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
460		autorest.ByClosing())
461	result.Response = resp
462	return
463}
464
465// Get lists the notification hubs associated with a namespace.
466// Parameters:
467// resourceGroupName - the name of the resource group.
468// namespaceName - the namespace name.
469// notificationHubName - the notification hub name.
470func (client Client) Get(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (result ResourceType, err error) {
471	if tracing.IsEnabled() {
472		ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get")
473		defer func() {
474			sc := -1
475			if result.Response.Response != nil {
476				sc = result.Response.Response.StatusCode
477			}
478			tracing.EndSpan(ctx, sc, err)
479		}()
480	}
481	req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, notificationHubName)
482	if err != nil {
483		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Get", nil, "Failure preparing request")
484		return
485	}
486
487	resp, err := client.GetSender(req)
488	if err != nil {
489		result.Response = autorest.Response{Response: resp}
490		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Get", resp, "Failure sending request")
491		return
492	}
493
494	result, err = client.GetResponder(resp)
495	if err != nil {
496		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Get", resp, "Failure responding to request")
497	}
498
499	return
500}
501
502// GetPreparer prepares the Get request.
503func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) {
504	pathParameters := map[string]interface{}{
505		"namespaceName":       autorest.Encode("path", namespaceName),
506		"notificationHubName": autorest.Encode("path", notificationHubName),
507		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
508		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
509	}
510
511	const APIVersion = "2016-03-01"
512	queryParameters := map[string]interface{}{
513		"api-version": APIVersion,
514	}
515
516	preparer := autorest.CreatePreparer(
517		autorest.AsGet(),
518		autorest.WithBaseURL(client.BaseURI),
519		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters),
520		autorest.WithQueryParameters(queryParameters))
521	return preparer.Prepare((&http.Request{}).WithContext(ctx))
522}
523
524// GetSender sends the Get request. The method will close the
525// http.Response Body if it receives an error.
526func (client Client) GetSender(req *http.Request) (*http.Response, error) {
527	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
528}
529
530// GetResponder handles the response to the Get request. The method always
531// closes the http.Response Body.
532func (client Client) GetResponder(resp *http.Response) (result ResourceType, err error) {
533	err = autorest.Respond(
534		resp,
535		client.ByInspecting(),
536		azure.WithErrorUnlessStatusCode(http.StatusOK),
537		autorest.ByUnmarshallingJSON(&result),
538		autorest.ByClosing())
539	result.Response = autorest.Response{Response: resp}
540	return
541}
542
543// GetAuthorizationRule gets an authorization rule for a NotificationHub by name.
544// Parameters:
545// resourceGroupName - the name of the resource group.
546// namespaceName - the namespace name
547// notificationHubName - the notification hub name.
548// authorizationRuleName - authorization rule name.
549func (client Client) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) {
550	if tracing.IsEnabled() {
551		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetAuthorizationRule")
552		defer func() {
553			sc := -1
554			if result.Response.Response != nil {
555				sc = result.Response.Response.StatusCode
556			}
557			tracing.EndSpan(ctx, sc, err)
558		}()
559	}
560	req, err := client.GetAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName)
561	if err != nil {
562		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetAuthorizationRule", nil, "Failure preparing request")
563		return
564	}
565
566	resp, err := client.GetAuthorizationRuleSender(req)
567	if err != nil {
568		result.Response = autorest.Response{Response: resp}
569		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetAuthorizationRule", resp, "Failure sending request")
570		return
571	}
572
573	result, err = client.GetAuthorizationRuleResponder(resp)
574	if err != nil {
575		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetAuthorizationRule", resp, "Failure responding to request")
576	}
577
578	return
579}
580
581// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request.
582func (client Client) GetAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) {
583	pathParameters := map[string]interface{}{
584		"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
585		"namespaceName":         autorest.Encode("path", namespaceName),
586		"notificationHubName":   autorest.Encode("path", notificationHubName),
587		"resourceGroupName":     autorest.Encode("path", resourceGroupName),
588		"subscriptionId":        autorest.Encode("path", client.SubscriptionID),
589	}
590
591	const APIVersion = "2016-03-01"
592	queryParameters := map[string]interface{}{
593		"api-version": APIVersion,
594	}
595
596	preparer := autorest.CreatePreparer(
597		autorest.AsGet(),
598		autorest.WithBaseURL(client.BaseURI),
599		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters),
600		autorest.WithQueryParameters(queryParameters))
601	return preparer.Prepare((&http.Request{}).WithContext(ctx))
602}
603
604// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the
605// http.Response Body if it receives an error.
606func (client Client) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) {
607	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
608}
609
610// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always
611// closes the http.Response Body.
612func (client Client) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) {
613	err = autorest.Respond(
614		resp,
615		client.ByInspecting(),
616		azure.WithErrorUnlessStatusCode(http.StatusOK),
617		autorest.ByUnmarshallingJSON(&result),
618		autorest.ByClosing())
619	result.Response = autorest.Response{Response: resp}
620	return
621}
622
623// GetPnsCredentials lists the PNS Credentials associated with a notification hub .
624// Parameters:
625// resourceGroupName - the name of the resource group.
626// namespaceName - the namespace name.
627// notificationHubName - the notification hub name.
628func (client Client) GetPnsCredentials(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (result PnsCredentialsResource, err error) {
629	if tracing.IsEnabled() {
630		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetPnsCredentials")
631		defer func() {
632			sc := -1
633			if result.Response.Response != nil {
634				sc = result.Response.Response.StatusCode
635			}
636			tracing.EndSpan(ctx, sc, err)
637		}()
638	}
639	req, err := client.GetPnsCredentialsPreparer(ctx, resourceGroupName, namespaceName, notificationHubName)
640	if err != nil {
641		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetPnsCredentials", nil, "Failure preparing request")
642		return
643	}
644
645	resp, err := client.GetPnsCredentialsSender(req)
646	if err != nil {
647		result.Response = autorest.Response{Response: resp}
648		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetPnsCredentials", resp, "Failure sending request")
649		return
650	}
651
652	result, err = client.GetPnsCredentialsResponder(resp)
653	if err != nil {
654		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetPnsCredentials", resp, "Failure responding to request")
655	}
656
657	return
658}
659
660// GetPnsCredentialsPreparer prepares the GetPnsCredentials request.
661func (client Client) GetPnsCredentialsPreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) {
662	pathParameters := map[string]interface{}{
663		"namespaceName":       autorest.Encode("path", namespaceName),
664		"notificationHubName": autorest.Encode("path", notificationHubName),
665		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
666		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
667	}
668
669	const APIVersion = "2016-03-01"
670	queryParameters := map[string]interface{}{
671		"api-version": APIVersion,
672	}
673
674	preparer := autorest.CreatePreparer(
675		autorest.AsPost(),
676		autorest.WithBaseURL(client.BaseURI),
677		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/pnsCredentials", pathParameters),
678		autorest.WithQueryParameters(queryParameters))
679	return preparer.Prepare((&http.Request{}).WithContext(ctx))
680}
681
682// GetPnsCredentialsSender sends the GetPnsCredentials request. The method will close the
683// http.Response Body if it receives an error.
684func (client Client) GetPnsCredentialsSender(req *http.Request) (*http.Response, error) {
685	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
686}
687
688// GetPnsCredentialsResponder handles the response to the GetPnsCredentials request. The method always
689// closes the http.Response Body.
690func (client Client) GetPnsCredentialsResponder(resp *http.Response) (result PnsCredentialsResource, err error) {
691	err = autorest.Respond(
692		resp,
693		client.ByInspecting(),
694		azure.WithErrorUnlessStatusCode(http.StatusOK),
695		autorest.ByUnmarshallingJSON(&result),
696		autorest.ByClosing())
697	result.Response = autorest.Response{Response: resp}
698	return
699}
700
701// List lists the notification hubs associated with a namespace.
702// Parameters:
703// resourceGroupName - the name of the resource group.
704// namespaceName - the namespace name.
705func (client Client) List(ctx context.Context, resourceGroupName string, namespaceName string) (result ListResultPage, err error) {
706	if tracing.IsEnabled() {
707		ctx = tracing.StartSpan(ctx, fqdn+"/Client.List")
708		defer func() {
709			sc := -1
710			if result.lr.Response.Response != nil {
711				sc = result.lr.Response.Response.StatusCode
712			}
713			tracing.EndSpan(ctx, sc, err)
714		}()
715	}
716	result.fn = client.listNextResults
717	req, err := client.ListPreparer(ctx, resourceGroupName, namespaceName)
718	if err != nil {
719		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "List", nil, "Failure preparing request")
720		return
721	}
722
723	resp, err := client.ListSender(req)
724	if err != nil {
725		result.lr.Response = autorest.Response{Response: resp}
726		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "List", resp, "Failure sending request")
727		return
728	}
729
730	result.lr, err = client.ListResponder(resp)
731	if err != nil {
732		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "List", resp, "Failure responding to request")
733	}
734
735	return
736}
737
738// ListPreparer prepares the List request.
739func (client Client) ListPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) {
740	pathParameters := map[string]interface{}{
741		"namespaceName":     autorest.Encode("path", namespaceName),
742		"resourceGroupName": autorest.Encode("path", resourceGroupName),
743		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
744	}
745
746	const APIVersion = "2016-03-01"
747	queryParameters := map[string]interface{}{
748		"api-version": APIVersion,
749	}
750
751	preparer := autorest.CreatePreparer(
752		autorest.AsGet(),
753		autorest.WithBaseURL(client.BaseURI),
754		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs", pathParameters),
755		autorest.WithQueryParameters(queryParameters))
756	return preparer.Prepare((&http.Request{}).WithContext(ctx))
757}
758
759// ListSender sends the List request. The method will close the
760// http.Response Body if it receives an error.
761func (client Client) ListSender(req *http.Request) (*http.Response, error) {
762	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
763}
764
765// ListResponder handles the response to the List request. The method always
766// closes the http.Response Body.
767func (client Client) ListResponder(resp *http.Response) (result ListResult, err error) {
768	err = autorest.Respond(
769		resp,
770		client.ByInspecting(),
771		azure.WithErrorUnlessStatusCode(http.StatusOK),
772		autorest.ByUnmarshallingJSON(&result),
773		autorest.ByClosing())
774	result.Response = autorest.Response{Response: resp}
775	return
776}
777
778// listNextResults retrieves the next set of results, if any.
779func (client Client) listNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) {
780	req, err := lastResults.listResultPreparer(ctx)
781	if err != nil {
782		return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "listNextResults", nil, "Failure preparing next results request")
783	}
784	if req == nil {
785		return
786	}
787	resp, err := client.ListSender(req)
788	if err != nil {
789		result.Response = autorest.Response{Response: resp}
790		return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "listNextResults", resp, "Failure sending next results request")
791	}
792	result, err = client.ListResponder(resp)
793	if err != nil {
794		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "listNextResults", resp, "Failure responding to next results request")
795	}
796	return
797}
798
799// ListComplete enumerates all values, automatically crossing page boundaries as required.
800func (client Client) ListComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result ListResultIterator, err error) {
801	if tracing.IsEnabled() {
802		ctx = tracing.StartSpan(ctx, fqdn+"/Client.List")
803		defer func() {
804			sc := -1
805			if result.Response().Response.Response != nil {
806				sc = result.page.Response().Response.Response.StatusCode
807			}
808			tracing.EndSpan(ctx, sc, err)
809		}()
810	}
811	result.page, err = client.List(ctx, resourceGroupName, namespaceName)
812	return
813}
814
815// ListAuthorizationRules gets the authorization rules for a NotificationHub.
816// Parameters:
817// resourceGroupName - the name of the resource group.
818// namespaceName - the namespace name
819// notificationHubName - the notification hub name.
820func (client Client) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (result SharedAccessAuthorizationRuleListResultPage, err error) {
821	if tracing.IsEnabled() {
822		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListAuthorizationRules")
823		defer func() {
824			sc := -1
825			if result.saarlr.Response.Response != nil {
826				sc = result.saarlr.Response.Response.StatusCode
827			}
828			tracing.EndSpan(ctx, sc, err)
829		}()
830	}
831	result.fn = client.listAuthorizationRulesNextResults
832	req, err := client.ListAuthorizationRulesPreparer(ctx, resourceGroupName, namespaceName, notificationHubName)
833	if err != nil {
834		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListAuthorizationRules", nil, "Failure preparing request")
835		return
836	}
837
838	resp, err := client.ListAuthorizationRulesSender(req)
839	if err != nil {
840		result.saarlr.Response = autorest.Response{Response: resp}
841		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListAuthorizationRules", resp, "Failure sending request")
842		return
843	}
844
845	result.saarlr, err = client.ListAuthorizationRulesResponder(resp)
846	if err != nil {
847		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListAuthorizationRules", resp, "Failure responding to request")
848	}
849
850	return
851}
852
853// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request.
854func (client Client) ListAuthorizationRulesPreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) {
855	pathParameters := map[string]interface{}{
856		"namespaceName":       autorest.Encode("path", namespaceName),
857		"notificationHubName": autorest.Encode("path", notificationHubName),
858		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
859		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
860	}
861
862	const APIVersion = "2016-03-01"
863	queryParameters := map[string]interface{}{
864		"api-version": APIVersion,
865	}
866
867	preparer := autorest.CreatePreparer(
868		autorest.AsGet(),
869		autorest.WithBaseURL(client.BaseURI),
870		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules", pathParameters),
871		autorest.WithQueryParameters(queryParameters))
872	return preparer.Prepare((&http.Request{}).WithContext(ctx))
873}
874
875// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the
876// http.Response Body if it receives an error.
877func (client Client) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) {
878	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
879}
880
881// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always
882// closes the http.Response Body.
883func (client Client) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) {
884	err = autorest.Respond(
885		resp,
886		client.ByInspecting(),
887		azure.WithErrorUnlessStatusCode(http.StatusOK),
888		autorest.ByUnmarshallingJSON(&result),
889		autorest.ByClosing())
890	result.Response = autorest.Response{Response: resp}
891	return
892}
893
894// listAuthorizationRulesNextResults retrieves the next set of results, if any.
895func (client Client) listAuthorizationRulesNextResults(ctx context.Context, lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) {
896	req, err := lastResults.sharedAccessAuthorizationRuleListResultPreparer(ctx)
897	if err != nil {
898		return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "listAuthorizationRulesNextResults", nil, "Failure preparing next results request")
899	}
900	if req == nil {
901		return
902	}
903	resp, err := client.ListAuthorizationRulesSender(req)
904	if err != nil {
905		result.Response = autorest.Response{Response: resp}
906		return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "listAuthorizationRulesNextResults", resp, "Failure sending next results request")
907	}
908	result, err = client.ListAuthorizationRulesResponder(resp)
909	if err != nil {
910		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "listAuthorizationRulesNextResults", resp, "Failure responding to next results request")
911	}
912	return
913}
914
915// ListAuthorizationRulesComplete enumerates all values, automatically crossing page boundaries as required.
916func (client Client) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (result SharedAccessAuthorizationRuleListResultIterator, err error) {
917	if tracing.IsEnabled() {
918		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListAuthorizationRules")
919		defer func() {
920			sc := -1
921			if result.Response().Response.Response != nil {
922				sc = result.page.Response().Response.Response.StatusCode
923			}
924			tracing.EndSpan(ctx, sc, err)
925		}()
926	}
927	result.page, err = client.ListAuthorizationRules(ctx, resourceGroupName, namespaceName, notificationHubName)
928	return
929}
930
931// ListKeys gets the Primary and Secondary ConnectionStrings to the NotificationHub
932// Parameters:
933// resourceGroupName - the name of the resource group.
934// namespaceName - the namespace name.
935// notificationHubName - the notification hub name.
936// authorizationRuleName - the connection string of the NotificationHub for the specified authorizationRule.
937func (client Client) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result ResourceListKeys, err error) {
938	if tracing.IsEnabled() {
939		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListKeys")
940		defer func() {
941			sc := -1
942			if result.Response.Response != nil {
943				sc = result.Response.Response.StatusCode
944			}
945			tracing.EndSpan(ctx, sc, err)
946		}()
947	}
948	req, err := client.ListKeysPreparer(ctx, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName)
949	if err != nil {
950		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListKeys", nil, "Failure preparing request")
951		return
952	}
953
954	resp, err := client.ListKeysSender(req)
955	if err != nil {
956		result.Response = autorest.Response{Response: resp}
957		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListKeys", resp, "Failure sending request")
958		return
959	}
960
961	result, err = client.ListKeysResponder(resp)
962	if err != nil {
963		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListKeys", resp, "Failure responding to request")
964	}
965
966	return
967}
968
969// ListKeysPreparer prepares the ListKeys request.
970func (client Client) ListKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) {
971	pathParameters := map[string]interface{}{
972		"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
973		"namespaceName":         autorest.Encode("path", namespaceName),
974		"notificationHubName":   autorest.Encode("path", notificationHubName),
975		"resourceGroupName":     autorest.Encode("path", resourceGroupName),
976		"subscriptionId":        autorest.Encode("path", client.SubscriptionID),
977	}
978
979	const APIVersion = "2016-03-01"
980	queryParameters := map[string]interface{}{
981		"api-version": APIVersion,
982	}
983
984	preparer := autorest.CreatePreparer(
985		autorest.AsPost(),
986		autorest.WithBaseURL(client.BaseURI),
987		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters),
988		autorest.WithQueryParameters(queryParameters))
989	return preparer.Prepare((&http.Request{}).WithContext(ctx))
990}
991
992// ListKeysSender sends the ListKeys request. The method will close the
993// http.Response Body if it receives an error.
994func (client Client) ListKeysSender(req *http.Request) (*http.Response, error) {
995	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
996}
997
998// ListKeysResponder handles the response to the ListKeys request. The method always
999// closes the http.Response Body.
1000func (client Client) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) {
1001	err = autorest.Respond(
1002		resp,
1003		client.ByInspecting(),
1004		azure.WithErrorUnlessStatusCode(http.StatusOK),
1005		autorest.ByUnmarshallingJSON(&result),
1006		autorest.ByClosing())
1007	result.Response = autorest.Response{Response: resp}
1008	return
1009}
1010
1011// RegenerateKeys regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule
1012// Parameters:
1013// resourceGroupName - the name of the resource group.
1014// namespaceName - the namespace name.
1015// notificationHubName - the notification hub name.
1016// authorizationRuleName - the connection string of the NotificationHub for the specified authorizationRule.
1017// parameters - parameters supplied to regenerate the NotificationHub Authorization Rule Key.
1018func (client Client) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (result ResourceListKeys, err error) {
1019	if tracing.IsEnabled() {
1020		ctx = tracing.StartSpan(ctx, fqdn+"/Client.RegenerateKeys")
1021		defer func() {
1022			sc := -1
1023			if result.Response.Response != nil {
1024				sc = result.Response.Response.StatusCode
1025			}
1026			tracing.EndSpan(ctx, sc, err)
1027		}()
1028	}
1029	req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters)
1030	if err != nil {
1031		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "RegenerateKeys", nil, "Failure preparing request")
1032		return
1033	}
1034
1035	resp, err := client.RegenerateKeysSender(req)
1036	if err != nil {
1037		result.Response = autorest.Response{Response: resp}
1038		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "RegenerateKeys", resp, "Failure sending request")
1039		return
1040	}
1041
1042	result, err = client.RegenerateKeysResponder(resp)
1043	if err != nil {
1044		err = autorest.NewErrorWithError(err, "notificationhubs.Client", "RegenerateKeys", resp, "Failure responding to request")
1045	}
1046
1047	return
1048}
1049
1050// RegenerateKeysPreparer prepares the RegenerateKeys request.
1051func (client Client) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (*http.Request, error) {
1052	pathParameters := map[string]interface{}{
1053		"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
1054		"namespaceName":         autorest.Encode("path", namespaceName),
1055		"notificationHubName":   autorest.Encode("path", notificationHubName),
1056		"resourceGroupName":     autorest.Encode("path", resourceGroupName),
1057		"subscriptionId":        autorest.Encode("path", client.SubscriptionID),
1058	}
1059
1060	const APIVersion = "2016-03-01"
1061	queryParameters := map[string]interface{}{
1062		"api-version": APIVersion,
1063	}
1064
1065	preparer := autorest.CreatePreparer(
1066		autorest.AsContentType("application/json; charset=utf-8"),
1067		autorest.AsPost(),
1068		autorest.WithBaseURL(client.BaseURI),
1069		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters),
1070		autorest.WithJSON(parameters),
1071		autorest.WithQueryParameters(queryParameters))
1072	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1073}
1074
1075// RegenerateKeysSender sends the RegenerateKeys request. The method will close the
1076// http.Response Body if it receives an error.
1077func (client Client) RegenerateKeysSender(req *http.Request) (*http.Response, error) {
1078	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1079}
1080
1081// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always
1082// closes the http.Response Body.
1083func (client Client) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) {
1084	err = autorest.Respond(
1085		resp,
1086		client.ByInspecting(),
1087		azure.WithErrorUnlessStatusCode(http.StatusOK),
1088		autorest.ByUnmarshallingJSON(&result),
1089		autorest.ByClosing())
1090	result.Response = autorest.Response{Response: resp}
1091	return
1092}
1093