1package adhybridhealthservice
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/date"
25	"github.com/Azure/go-autorest/tracing"
26	"net/http"
27)
28
29// ServicesClient is the REST APIs for Azure Active Directory Connect Health
30type ServicesClient struct {
31	BaseClient
32}
33
34// NewServicesClient creates an instance of the ServicesClient client.
35func NewServicesClient() ServicesClient {
36	return NewServicesClientWithBaseURI(DefaultBaseURI)
37}
38
39// NewServicesClientWithBaseURI creates an instance of the ServicesClient client.
40func NewServicesClientWithBaseURI(baseURI string) ServicesClient {
41	return ServicesClient{NewWithBaseURI(baseURI)}
42}
43
44// Add onboards a service for a given tenant in Azure Active Directory Connect Health.
45// Parameters:
46// service - the service object.
47func (client ServicesClient) Add(ctx context.Context, service ServiceProperties) (result ServiceProperties, err error) {
48	if tracing.IsEnabled() {
49		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Add")
50		defer func() {
51			sc := -1
52			if result.Response.Response != nil {
53				sc = result.Response.Response.StatusCode
54			}
55			tracing.EndSpan(ctx, sc, err)
56		}()
57	}
58	req, err := client.AddPreparer(ctx, service)
59	if err != nil {
60		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "Add", nil, "Failure preparing request")
61		return
62	}
63
64	resp, err := client.AddSender(req)
65	if err != nil {
66		result.Response = autorest.Response{Response: resp}
67		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "Add", resp, "Failure sending request")
68		return
69	}
70
71	result, err = client.AddResponder(resp)
72	if err != nil {
73		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "Add", resp, "Failure responding to request")
74	}
75
76	return
77}
78
79// AddPreparer prepares the Add request.
80func (client ServicesClient) AddPreparer(ctx context.Context, service ServiceProperties) (*http.Request, error) {
81	const APIVersion = "2014-01-01"
82	queryParameters := map[string]interface{}{
83		"api-version": APIVersion,
84	}
85
86	preparer := autorest.CreatePreparer(
87		autorest.AsContentType("application/json; charset=utf-8"),
88		autorest.AsPost(),
89		autorest.WithBaseURL(client.BaseURI),
90		autorest.WithPath("/providers/Microsoft.ADHybridHealthService/services"),
91		autorest.WithJSON(service),
92		autorest.WithQueryParameters(queryParameters))
93	return preparer.Prepare((&http.Request{}).WithContext(ctx))
94}
95
96// AddSender sends the Add request. The method will close the
97// http.Response Body if it receives an error.
98func (client ServicesClient) AddSender(req *http.Request) (*http.Response, error) {
99	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
100	return autorest.SendWithSender(client, req, sd...)
101}
102
103// AddResponder handles the response to the Add request. The method always
104// closes the http.Response Body.
105func (client ServicesClient) AddResponder(resp *http.Response) (result ServiceProperties, err error) {
106	err = autorest.Respond(
107		resp,
108		client.ByInspecting(),
109		azure.WithErrorUnlessStatusCode(http.StatusOK),
110		autorest.ByUnmarshallingJSON(&result),
111		autorest.ByClosing())
112	result.Response = autorest.Response{Response: resp}
113	return
114}
115
116// AddAlertFeedback adds an alert feedback submitted by customer.
117// Parameters:
118// serviceName - the name of the service.
119// alertFeedback - the alert feedback.
120func (client ServicesClient) AddAlertFeedback(ctx context.Context, serviceName string, alertFeedback AlertFeedback) (result AlertFeedback, err error) {
121	if tracing.IsEnabled() {
122		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.AddAlertFeedback")
123		defer func() {
124			sc := -1
125			if result.Response.Response != nil {
126				sc = result.Response.Response.StatusCode
127			}
128			tracing.EndSpan(ctx, sc, err)
129		}()
130	}
131	req, err := client.AddAlertFeedbackPreparer(ctx, serviceName, alertFeedback)
132	if err != nil {
133		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "AddAlertFeedback", nil, "Failure preparing request")
134		return
135	}
136
137	resp, err := client.AddAlertFeedbackSender(req)
138	if err != nil {
139		result.Response = autorest.Response{Response: resp}
140		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "AddAlertFeedback", resp, "Failure sending request")
141		return
142	}
143
144	result, err = client.AddAlertFeedbackResponder(resp)
145	if err != nil {
146		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "AddAlertFeedback", resp, "Failure responding to request")
147	}
148
149	return
150}
151
152// AddAlertFeedbackPreparer prepares the AddAlertFeedback request.
153func (client ServicesClient) AddAlertFeedbackPreparer(ctx context.Context, serviceName string, alertFeedback AlertFeedback) (*http.Request, error) {
154	pathParameters := map[string]interface{}{
155		"serviceName": autorest.Encode("path", serviceName),
156	}
157
158	const APIVersion = "2014-01-01"
159	queryParameters := map[string]interface{}{
160		"api-version": APIVersion,
161	}
162
163	preparer := autorest.CreatePreparer(
164		autorest.AsContentType("application/json; charset=utf-8"),
165		autorest.AsPost(),
166		autorest.WithBaseURL(client.BaseURI),
167		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/feedbacktype/alerts/feedback", pathParameters),
168		autorest.WithJSON(alertFeedback),
169		autorest.WithQueryParameters(queryParameters))
170	return preparer.Prepare((&http.Request{}).WithContext(ctx))
171}
172
173// AddAlertFeedbackSender sends the AddAlertFeedback request. The method will close the
174// http.Response Body if it receives an error.
175func (client ServicesClient) AddAlertFeedbackSender(req *http.Request) (*http.Response, error) {
176	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
177	return autorest.SendWithSender(client, req, sd...)
178}
179
180// AddAlertFeedbackResponder handles the response to the AddAlertFeedback request. The method always
181// closes the http.Response Body.
182func (client ServicesClient) AddAlertFeedbackResponder(resp *http.Response) (result AlertFeedback, err error) {
183	err = autorest.Respond(
184		resp,
185		client.ByInspecting(),
186		azure.WithErrorUnlessStatusCode(http.StatusOK),
187		autorest.ByUnmarshallingJSON(&result),
188		autorest.ByClosing())
189	result.Response = autorest.Response{Response: resp}
190	return
191}
192
193// Delete deletes a service which is onboarded to Azure Active Directory Connect Health.
194// Parameters:
195// serviceName - the name of the service which needs to be deleted.
196// confirm - indicates if the service will be permanently deleted or disabled. True indicates that the service
197// will be permanently deleted and False indicates that the service will be marked disabled and then deleted
198// after 30 days, if it is not re-registered.
199func (client ServicesClient) Delete(ctx context.Context, serviceName string, confirm *bool) (result autorest.Response, err error) {
200	if tracing.IsEnabled() {
201		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Delete")
202		defer func() {
203			sc := -1
204			if result.Response != nil {
205				sc = result.Response.StatusCode
206			}
207			tracing.EndSpan(ctx, sc, err)
208		}()
209	}
210	req, err := client.DeletePreparer(ctx, serviceName, confirm)
211	if err != nil {
212		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "Delete", nil, "Failure preparing request")
213		return
214	}
215
216	resp, err := client.DeleteSender(req)
217	if err != nil {
218		result.Response = resp
219		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "Delete", resp, "Failure sending request")
220		return
221	}
222
223	result, err = client.DeleteResponder(resp)
224	if err != nil {
225		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "Delete", resp, "Failure responding to request")
226	}
227
228	return
229}
230
231// DeletePreparer prepares the Delete request.
232func (client ServicesClient) DeletePreparer(ctx context.Context, serviceName string, confirm *bool) (*http.Request, error) {
233	pathParameters := map[string]interface{}{
234		"serviceName": autorest.Encode("path", serviceName),
235	}
236
237	const APIVersion = "2014-01-01"
238	queryParameters := map[string]interface{}{
239		"api-version": APIVersion,
240	}
241	if confirm != nil {
242		queryParameters["confirm"] = autorest.Encode("query", *confirm)
243	}
244
245	preparer := autorest.CreatePreparer(
246		autorest.AsDelete(),
247		autorest.WithBaseURL(client.BaseURI),
248		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}", pathParameters),
249		autorest.WithQueryParameters(queryParameters))
250	return preparer.Prepare((&http.Request{}).WithContext(ctx))
251}
252
253// DeleteSender sends the Delete request. The method will close the
254// http.Response Body if it receives an error.
255func (client ServicesClient) DeleteSender(req *http.Request) (*http.Response, error) {
256	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
257	return autorest.SendWithSender(client, req, sd...)
258}
259
260// DeleteResponder handles the response to the Delete request. The method always
261// closes the http.Response Body.
262func (client ServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
263	err = autorest.Respond(
264		resp,
265		client.ByInspecting(),
266		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
267		autorest.ByClosing())
268	result.Response = resp
269	return
270}
271
272// Get gets the details of a service for a tenant having Azure AD Premium license and is onboarded to Azure Active
273// Directory Connect Health.
274// Parameters:
275// serviceName - the name of the service.
276func (client ServicesClient) Get(ctx context.Context, serviceName string) (result ServiceProperties, err error) {
277	if tracing.IsEnabled() {
278		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Get")
279		defer func() {
280			sc := -1
281			if result.Response.Response != nil {
282				sc = result.Response.Response.StatusCode
283			}
284			tracing.EndSpan(ctx, sc, err)
285		}()
286	}
287	req, err := client.GetPreparer(ctx, serviceName)
288	if err != nil {
289		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "Get", nil, "Failure preparing request")
290		return
291	}
292
293	resp, err := client.GetSender(req)
294	if err != nil {
295		result.Response = autorest.Response{Response: resp}
296		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "Get", resp, "Failure sending request")
297		return
298	}
299
300	result, err = client.GetResponder(resp)
301	if err != nil {
302		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "Get", resp, "Failure responding to request")
303	}
304
305	return
306}
307
308// GetPreparer prepares the Get request.
309func (client ServicesClient) GetPreparer(ctx context.Context, serviceName string) (*http.Request, error) {
310	pathParameters := map[string]interface{}{
311		"serviceName": autorest.Encode("path", serviceName),
312	}
313
314	const APIVersion = "2014-01-01"
315	queryParameters := map[string]interface{}{
316		"api-version": APIVersion,
317	}
318
319	preparer := autorest.CreatePreparer(
320		autorest.AsGet(),
321		autorest.WithBaseURL(client.BaseURI),
322		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}", pathParameters),
323		autorest.WithQueryParameters(queryParameters))
324	return preparer.Prepare((&http.Request{}).WithContext(ctx))
325}
326
327// GetSender sends the Get request. The method will close the
328// http.Response Body if it receives an error.
329func (client ServicesClient) GetSender(req *http.Request) (*http.Response, error) {
330	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
331	return autorest.SendWithSender(client, req, sd...)
332}
333
334// GetResponder handles the response to the Get request. The method always
335// closes the http.Response Body.
336func (client ServicesClient) GetResponder(resp *http.Response) (result ServiceProperties, err error) {
337	err = autorest.Respond(
338		resp,
339		client.ByInspecting(),
340		azure.WithErrorUnlessStatusCode(http.StatusOK),
341		autorest.ByUnmarshallingJSON(&result),
342		autorest.ByClosing())
343	result.Response = autorest.Response{Response: resp}
344	return
345}
346
347// GetFeatureAvailibility checks if the service has all the pre-requisites met to use a feature.
348// Parameters:
349// serviceName - the name of the service.
350// featureName - the name of the feature.
351func (client ServicesClient) GetFeatureAvailibility(ctx context.Context, serviceName string, featureName string) (result Result, err error) {
352	if tracing.IsEnabled() {
353		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.GetFeatureAvailibility")
354		defer func() {
355			sc := -1
356			if result.Response.Response != nil {
357				sc = result.Response.Response.StatusCode
358			}
359			tracing.EndSpan(ctx, sc, err)
360		}()
361	}
362	req, err := client.GetFeatureAvailibilityPreparer(ctx, serviceName, featureName)
363	if err != nil {
364		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "GetFeatureAvailibility", nil, "Failure preparing request")
365		return
366	}
367
368	resp, err := client.GetFeatureAvailibilitySender(req)
369	if err != nil {
370		result.Response = autorest.Response{Response: resp}
371		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "GetFeatureAvailibility", resp, "Failure sending request")
372		return
373	}
374
375	result, err = client.GetFeatureAvailibilityResponder(resp)
376	if err != nil {
377		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "GetFeatureAvailibility", resp, "Failure responding to request")
378	}
379
380	return
381}
382
383// GetFeatureAvailibilityPreparer prepares the GetFeatureAvailibility request.
384func (client ServicesClient) GetFeatureAvailibilityPreparer(ctx context.Context, serviceName string, featureName string) (*http.Request, error) {
385	pathParameters := map[string]interface{}{
386		"featureName": autorest.Encode("path", featureName),
387		"serviceName": autorest.Encode("path", serviceName),
388	}
389
390	const APIVersion = "2014-01-01"
391	queryParameters := map[string]interface{}{
392		"api-version": APIVersion,
393	}
394
395	preparer := autorest.CreatePreparer(
396		autorest.AsGet(),
397		autorest.WithBaseURL(client.BaseURI),
398		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/checkServiceFeatureAvailibility/{featureName}", pathParameters),
399		autorest.WithQueryParameters(queryParameters))
400	return preparer.Prepare((&http.Request{}).WithContext(ctx))
401}
402
403// GetFeatureAvailibilitySender sends the GetFeatureAvailibility request. The method will close the
404// http.Response Body if it receives an error.
405func (client ServicesClient) GetFeatureAvailibilitySender(req *http.Request) (*http.Response, error) {
406	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
407	return autorest.SendWithSender(client, req, sd...)
408}
409
410// GetFeatureAvailibilityResponder handles the response to the GetFeatureAvailibility request. The method always
411// closes the http.Response Body.
412func (client ServicesClient) GetFeatureAvailibilityResponder(resp *http.Response) (result Result, err error) {
413	err = autorest.Respond(
414		resp,
415		client.ByInspecting(),
416		azure.WithErrorUnlessStatusCode(http.StatusOK),
417		autorest.ByUnmarshallingJSON(&result),
418		autorest.ByClosing())
419	result.Response = autorest.Response{Response: resp}
420	return
421}
422
423// GetMetricMetadata gets the service related metrics information.
424// Parameters:
425// serviceName - the name of the service.
426// metricName - the metric name
427func (client ServicesClient) GetMetricMetadata(ctx context.Context, serviceName string, metricName string) (result MetricMetadata, err error) {
428	if tracing.IsEnabled() {
429		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.GetMetricMetadata")
430		defer func() {
431			sc := -1
432			if result.Response.Response != nil {
433				sc = result.Response.Response.StatusCode
434			}
435			tracing.EndSpan(ctx, sc, err)
436		}()
437	}
438	req, err := client.GetMetricMetadataPreparer(ctx, serviceName, metricName)
439	if err != nil {
440		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "GetMetricMetadata", nil, "Failure preparing request")
441		return
442	}
443
444	resp, err := client.GetMetricMetadataSender(req)
445	if err != nil {
446		result.Response = autorest.Response{Response: resp}
447		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "GetMetricMetadata", resp, "Failure sending request")
448		return
449	}
450
451	result, err = client.GetMetricMetadataResponder(resp)
452	if err != nil {
453		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "GetMetricMetadata", resp, "Failure responding to request")
454	}
455
456	return
457}
458
459// GetMetricMetadataPreparer prepares the GetMetricMetadata request.
460func (client ServicesClient) GetMetricMetadataPreparer(ctx context.Context, serviceName string, metricName string) (*http.Request, error) {
461	pathParameters := map[string]interface{}{
462		"metricName":  autorest.Encode("path", metricName),
463		"serviceName": autorest.Encode("path", serviceName),
464	}
465
466	const APIVersion = "2014-01-01"
467	queryParameters := map[string]interface{}{
468		"api-version": APIVersion,
469	}
470
471	preparer := autorest.CreatePreparer(
472		autorest.AsGet(),
473		autorest.WithBaseURL(client.BaseURI),
474		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/metricmetadata/{metricName}", pathParameters),
475		autorest.WithQueryParameters(queryParameters))
476	return preparer.Prepare((&http.Request{}).WithContext(ctx))
477}
478
479// GetMetricMetadataSender sends the GetMetricMetadata request. The method will close the
480// http.Response Body if it receives an error.
481func (client ServicesClient) GetMetricMetadataSender(req *http.Request) (*http.Response, error) {
482	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
483	return autorest.SendWithSender(client, req, sd...)
484}
485
486// GetMetricMetadataResponder handles the response to the GetMetricMetadata request. The method always
487// closes the http.Response Body.
488func (client ServicesClient) GetMetricMetadataResponder(resp *http.Response) (result MetricMetadata, err error) {
489	err = autorest.Respond(
490		resp,
491		client.ByInspecting(),
492		azure.WithErrorUnlessStatusCode(http.StatusOK),
493		autorest.ByUnmarshallingJSON(&result),
494		autorest.ByClosing())
495	result.Response = autorest.Response{Response: resp}
496	return
497}
498
499// GetMetricMetadataForGroup gets the service related metrics for a given metric and group combination.
500// Parameters:
501// serviceName - the name of the service.
502// metricName - the metric name
503// groupName - the group name
504// groupKey - the group key
505// fromDate - the start date.
506// toDate - the end date.
507func (client ServicesClient) GetMetricMetadataForGroup(ctx context.Context, serviceName string, metricName string, groupName string, groupKey string, fromDate *date.Time, toDate *date.Time) (result MetricSets, err error) {
508	if tracing.IsEnabled() {
509		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.GetMetricMetadataForGroup")
510		defer func() {
511			sc := -1
512			if result.Response.Response != nil {
513				sc = result.Response.Response.StatusCode
514			}
515			tracing.EndSpan(ctx, sc, err)
516		}()
517	}
518	req, err := client.GetMetricMetadataForGroupPreparer(ctx, serviceName, metricName, groupName, groupKey, fromDate, toDate)
519	if err != nil {
520		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "GetMetricMetadataForGroup", nil, "Failure preparing request")
521		return
522	}
523
524	resp, err := client.GetMetricMetadataForGroupSender(req)
525	if err != nil {
526		result.Response = autorest.Response{Response: resp}
527		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "GetMetricMetadataForGroup", resp, "Failure sending request")
528		return
529	}
530
531	result, err = client.GetMetricMetadataForGroupResponder(resp)
532	if err != nil {
533		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "GetMetricMetadataForGroup", resp, "Failure responding to request")
534	}
535
536	return
537}
538
539// GetMetricMetadataForGroupPreparer prepares the GetMetricMetadataForGroup request.
540func (client ServicesClient) GetMetricMetadataForGroupPreparer(ctx context.Context, serviceName string, metricName string, groupName string, groupKey string, fromDate *date.Time, toDate *date.Time) (*http.Request, error) {
541	pathParameters := map[string]interface{}{
542		"groupName":   autorest.Encode("path", groupName),
543		"metricName":  autorest.Encode("path", metricName),
544		"serviceName": autorest.Encode("path", serviceName),
545	}
546
547	const APIVersion = "2014-01-01"
548	queryParameters := map[string]interface{}{
549		"api-version": APIVersion,
550	}
551	if len(groupKey) > 0 {
552		queryParameters["groupKey"] = autorest.Encode("query", groupKey)
553	}
554	if fromDate != nil {
555		queryParameters["fromDate"] = autorest.Encode("query", *fromDate)
556	}
557	if toDate != nil {
558		queryParameters["toDate"] = autorest.Encode("query", *toDate)
559	}
560
561	preparer := autorest.CreatePreparer(
562		autorest.AsGet(),
563		autorest.WithBaseURL(client.BaseURI),
564		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/metricmetadata/{metricName}/groups/{groupName}", pathParameters),
565		autorest.WithQueryParameters(queryParameters))
566	return preparer.Prepare((&http.Request{}).WithContext(ctx))
567}
568
569// GetMetricMetadataForGroupSender sends the GetMetricMetadataForGroup request. The method will close the
570// http.Response Body if it receives an error.
571func (client ServicesClient) GetMetricMetadataForGroupSender(req *http.Request) (*http.Response, error) {
572	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
573	return autorest.SendWithSender(client, req, sd...)
574}
575
576// GetMetricMetadataForGroupResponder handles the response to the GetMetricMetadataForGroup request. The method always
577// closes the http.Response Body.
578func (client ServicesClient) GetMetricMetadataForGroupResponder(resp *http.Response) (result MetricSets, err error) {
579	err = autorest.Respond(
580		resp,
581		client.ByInspecting(),
582		azure.WithErrorUnlessStatusCode(http.StatusOK),
583		autorest.ByUnmarshallingJSON(&result),
584		autorest.ByClosing())
585	result.Response = autorest.Response{Response: resp}
586	return
587}
588
589// GetTenantWhitelisting checks if the tenant, to which a service is registered, is whitelisted to use a feature.
590// Parameters:
591// serviceName - the name of the service.
592// featureName - the name of the feature.
593func (client ServicesClient) GetTenantWhitelisting(ctx context.Context, serviceName string, featureName string) (result Result, err error) {
594	if tracing.IsEnabled() {
595		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.GetTenantWhitelisting")
596		defer func() {
597			sc := -1
598			if result.Response.Response != nil {
599				sc = result.Response.Response.StatusCode
600			}
601			tracing.EndSpan(ctx, sc, err)
602		}()
603	}
604	req, err := client.GetTenantWhitelistingPreparer(ctx, serviceName, featureName)
605	if err != nil {
606		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "GetTenantWhitelisting", nil, "Failure preparing request")
607		return
608	}
609
610	resp, err := client.GetTenantWhitelistingSender(req)
611	if err != nil {
612		result.Response = autorest.Response{Response: resp}
613		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "GetTenantWhitelisting", resp, "Failure sending request")
614		return
615	}
616
617	result, err = client.GetTenantWhitelistingResponder(resp)
618	if err != nil {
619		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "GetTenantWhitelisting", resp, "Failure responding to request")
620	}
621
622	return
623}
624
625// GetTenantWhitelistingPreparer prepares the GetTenantWhitelisting request.
626func (client ServicesClient) GetTenantWhitelistingPreparer(ctx context.Context, serviceName string, featureName string) (*http.Request, error) {
627	pathParameters := map[string]interface{}{
628		"featureName": autorest.Encode("path", featureName),
629		"serviceName": autorest.Encode("path", serviceName),
630	}
631
632	const APIVersion = "2014-01-01"
633	queryParameters := map[string]interface{}{
634		"api-version": APIVersion,
635	}
636
637	preparer := autorest.CreatePreparer(
638		autorest.AsGet(),
639		autorest.WithBaseURL(client.BaseURI),
640		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/TenantWhitelisting/{featureName}", pathParameters),
641		autorest.WithQueryParameters(queryParameters))
642	return preparer.Prepare((&http.Request{}).WithContext(ctx))
643}
644
645// GetTenantWhitelistingSender sends the GetTenantWhitelisting request. The method will close the
646// http.Response Body if it receives an error.
647func (client ServicesClient) GetTenantWhitelistingSender(req *http.Request) (*http.Response, error) {
648	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
649	return autorest.SendWithSender(client, req, sd...)
650}
651
652// GetTenantWhitelistingResponder handles the response to the GetTenantWhitelisting request. The method always
653// closes the http.Response Body.
654func (client ServicesClient) GetTenantWhitelistingResponder(resp *http.Response) (result Result, err error) {
655	err = autorest.Respond(
656		resp,
657		client.ByInspecting(),
658		azure.WithErrorUnlessStatusCode(http.StatusOK),
659		autorest.ByUnmarshallingJSON(&result),
660		autorest.ByClosing())
661	result.Response = autorest.Response{Response: resp}
662	return
663}
664
665// List gets the details of services, for a tenant, that are onboarded to Azure Active Directory Connect Health.
666// Parameters:
667// filter - the service property filter to apply.
668// serviceType - the service type for the services onboarded to Azure Active Directory Connect Health.
669// Depending on whether the service is monitoring, ADFS, Sync or ADDS roles, the service type can either be
670// AdFederationService or AadSyncService or AdDomainService.
671// skipCount - the skip count, which specifies the number of elements that can be bypassed from a sequence and
672// then return the remaining elements.
673// takeCount - the take count , which specifies the number of elements that can be returned from a sequence.
674func (client ServicesClient) List(ctx context.Context, filter string, serviceType string, skipCount *int32, takeCount *int32) (result ServicesPage, err error) {
675	if tracing.IsEnabled() {
676		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.List")
677		defer func() {
678			sc := -1
679			if result.s.Response.Response != nil {
680				sc = result.s.Response.Response.StatusCode
681			}
682			tracing.EndSpan(ctx, sc, err)
683		}()
684	}
685	result.fn = client.listNextResults
686	req, err := client.ListPreparer(ctx, filter, serviceType, skipCount, takeCount)
687	if err != nil {
688		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "List", nil, "Failure preparing request")
689		return
690	}
691
692	resp, err := client.ListSender(req)
693	if err != nil {
694		result.s.Response = autorest.Response{Response: resp}
695		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "List", resp, "Failure sending request")
696		return
697	}
698
699	result.s, err = client.ListResponder(resp)
700	if err != nil {
701		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "List", resp, "Failure responding to request")
702	}
703
704	return
705}
706
707// ListPreparer prepares the List request.
708func (client ServicesClient) ListPreparer(ctx context.Context, filter string, serviceType string, skipCount *int32, takeCount *int32) (*http.Request, error) {
709	const APIVersion = "2014-01-01"
710	queryParameters := map[string]interface{}{
711		"api-version": APIVersion,
712	}
713	if len(filter) > 0 {
714		queryParameters["$filter"] = autorest.Encode("query", filter)
715	}
716	if len(serviceType) > 0 {
717		queryParameters["serviceType"] = autorest.Encode("query", serviceType)
718	}
719	if skipCount != nil {
720		queryParameters["skipCount"] = autorest.Encode("query", *skipCount)
721	}
722	if takeCount != nil {
723		queryParameters["takeCount"] = autorest.Encode("query", *takeCount)
724	}
725
726	preparer := autorest.CreatePreparer(
727		autorest.AsGet(),
728		autorest.WithBaseURL(client.BaseURI),
729		autorest.WithPath("/providers/Microsoft.ADHybridHealthService/services"),
730		autorest.WithQueryParameters(queryParameters))
731	return preparer.Prepare((&http.Request{}).WithContext(ctx))
732}
733
734// ListSender sends the List request. The method will close the
735// http.Response Body if it receives an error.
736func (client ServicesClient) ListSender(req *http.Request) (*http.Response, error) {
737	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
738	return autorest.SendWithSender(client, req, sd...)
739}
740
741// ListResponder handles the response to the List request. The method always
742// closes the http.Response Body.
743func (client ServicesClient) ListResponder(resp *http.Response) (result Services, err error) {
744	err = autorest.Respond(
745		resp,
746		client.ByInspecting(),
747		azure.WithErrorUnlessStatusCode(http.StatusOK),
748		autorest.ByUnmarshallingJSON(&result),
749		autorest.ByClosing())
750	result.Response = autorest.Response{Response: resp}
751	return
752}
753
754// listNextResults retrieves the next set of results, if any.
755func (client ServicesClient) listNextResults(ctx context.Context, lastResults Services) (result Services, err error) {
756	req, err := lastResults.servicesPreparer(ctx)
757	if err != nil {
758		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listNextResults", nil, "Failure preparing next results request")
759	}
760	if req == nil {
761		return
762	}
763	resp, err := client.ListSender(req)
764	if err != nil {
765		result.Response = autorest.Response{Response: resp}
766		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listNextResults", resp, "Failure sending next results request")
767	}
768	result, err = client.ListResponder(resp)
769	if err != nil {
770		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listNextResults", resp, "Failure responding to next results request")
771	}
772	return
773}
774
775// ListComplete enumerates all values, automatically crossing page boundaries as required.
776func (client ServicesClient) ListComplete(ctx context.Context, filter string, serviceType string, skipCount *int32, takeCount *int32) (result ServicesIterator, err error) {
777	if tracing.IsEnabled() {
778		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.List")
779		defer func() {
780			sc := -1
781			if result.Response().Response.Response != nil {
782				sc = result.page.Response().Response.Response.StatusCode
783			}
784			tracing.EndSpan(ctx, sc, err)
785		}()
786	}
787	result.page, err = client.List(ctx, filter, serviceType, skipCount, takeCount)
788	return
789}
790
791// ListAlertFeedback gets a list of all alert feedback for a given tenant and alert type.
792// Parameters:
793// serviceName - the name of the service.
794// shortName - the name of the alert.
795func (client ServicesClient) ListAlertFeedback(ctx context.Context, serviceName string, shortName string) (result AlertFeedbacks, err error) {
796	if tracing.IsEnabled() {
797		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListAlertFeedback")
798		defer func() {
799			sc := -1
800			if result.Response.Response != nil {
801				sc = result.Response.Response.StatusCode
802			}
803			tracing.EndSpan(ctx, sc, err)
804		}()
805	}
806	req, err := client.ListAlertFeedbackPreparer(ctx, serviceName, shortName)
807	if err != nil {
808		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListAlertFeedback", nil, "Failure preparing request")
809		return
810	}
811
812	resp, err := client.ListAlertFeedbackSender(req)
813	if err != nil {
814		result.Response = autorest.Response{Response: resp}
815		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListAlertFeedback", resp, "Failure sending request")
816		return
817	}
818
819	result, err = client.ListAlertFeedbackResponder(resp)
820	if err != nil {
821		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListAlertFeedback", resp, "Failure responding to request")
822	}
823
824	return
825}
826
827// ListAlertFeedbackPreparer prepares the ListAlertFeedback request.
828func (client ServicesClient) ListAlertFeedbackPreparer(ctx context.Context, serviceName string, shortName string) (*http.Request, error) {
829	pathParameters := map[string]interface{}{
830		"serviceName": autorest.Encode("path", serviceName),
831		"shortName":   autorest.Encode("path", shortName),
832	}
833
834	const APIVersion = "2014-01-01"
835	queryParameters := map[string]interface{}{
836		"api-version": APIVersion,
837	}
838
839	preparer := autorest.CreatePreparer(
840		autorest.AsGet(),
841		autorest.WithBaseURL(client.BaseURI),
842		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/feedbacktype/alerts/{shortName}/alertfeedback", pathParameters),
843		autorest.WithQueryParameters(queryParameters))
844	return preparer.Prepare((&http.Request{}).WithContext(ctx))
845}
846
847// ListAlertFeedbackSender sends the ListAlertFeedback request. The method will close the
848// http.Response Body if it receives an error.
849func (client ServicesClient) ListAlertFeedbackSender(req *http.Request) (*http.Response, error) {
850	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
851	return autorest.SendWithSender(client, req, sd...)
852}
853
854// ListAlertFeedbackResponder handles the response to the ListAlertFeedback request. The method always
855// closes the http.Response Body.
856func (client ServicesClient) ListAlertFeedbackResponder(resp *http.Response) (result AlertFeedbacks, err error) {
857	err = autorest.Respond(
858		resp,
859		client.ByInspecting(),
860		azure.WithErrorUnlessStatusCode(http.StatusOK),
861		autorest.ByUnmarshallingJSON(&result),
862		autorest.ByClosing())
863	result.Response = autorest.Response{Response: resp}
864	return
865}
866
867// ListAlerts gets the alerts for a given service.
868// Parameters:
869// serviceName - the name of the service.
870// filter - the alert property filter to apply.
871// state - the alert state to query for.
872// from - the start date to query for.
873// toParameter - the end date till when to query for.
874func (client ServicesClient) ListAlerts(ctx context.Context, serviceName string, filter string, state string, from *date.Time, toParameter *date.Time) (result AlertsPage, err error) {
875	if tracing.IsEnabled() {
876		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListAlerts")
877		defer func() {
878			sc := -1
879			if result.a.Response.Response != nil {
880				sc = result.a.Response.Response.StatusCode
881			}
882			tracing.EndSpan(ctx, sc, err)
883		}()
884	}
885	result.fn = client.listAlertsNextResults
886	req, err := client.ListAlertsPreparer(ctx, serviceName, filter, state, from, toParameter)
887	if err != nil {
888		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListAlerts", nil, "Failure preparing request")
889		return
890	}
891
892	resp, err := client.ListAlertsSender(req)
893	if err != nil {
894		result.a.Response = autorest.Response{Response: resp}
895		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListAlerts", resp, "Failure sending request")
896		return
897	}
898
899	result.a, err = client.ListAlertsResponder(resp)
900	if err != nil {
901		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListAlerts", resp, "Failure responding to request")
902	}
903
904	return
905}
906
907// ListAlertsPreparer prepares the ListAlerts request.
908func (client ServicesClient) ListAlertsPreparer(ctx context.Context, serviceName string, filter string, state string, from *date.Time, toParameter *date.Time) (*http.Request, error) {
909	pathParameters := map[string]interface{}{
910		"serviceName": autorest.Encode("path", serviceName),
911	}
912
913	const APIVersion = "2014-01-01"
914	queryParameters := map[string]interface{}{
915		"api-version": APIVersion,
916	}
917	if len(filter) > 0 {
918		queryParameters["$filter"] = autorest.Encode("query", filter)
919	}
920	if len(state) > 0 {
921		queryParameters["state"] = autorest.Encode("query", state)
922	}
923	if from != nil {
924		queryParameters["from"] = autorest.Encode("query", *from)
925	}
926	if toParameter != nil {
927		queryParameters["to"] = autorest.Encode("query", *toParameter)
928	}
929
930	preparer := autorest.CreatePreparer(
931		autorest.AsGet(),
932		autorest.WithBaseURL(client.BaseURI),
933		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/alerts", pathParameters),
934		autorest.WithQueryParameters(queryParameters))
935	return preparer.Prepare((&http.Request{}).WithContext(ctx))
936}
937
938// ListAlertsSender sends the ListAlerts request. The method will close the
939// http.Response Body if it receives an error.
940func (client ServicesClient) ListAlertsSender(req *http.Request) (*http.Response, error) {
941	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
942	return autorest.SendWithSender(client, req, sd...)
943}
944
945// ListAlertsResponder handles the response to the ListAlerts request. The method always
946// closes the http.Response Body.
947func (client ServicesClient) ListAlertsResponder(resp *http.Response) (result Alerts, err error) {
948	err = autorest.Respond(
949		resp,
950		client.ByInspecting(),
951		azure.WithErrorUnlessStatusCode(http.StatusOK),
952		autorest.ByUnmarshallingJSON(&result),
953		autorest.ByClosing())
954	result.Response = autorest.Response{Response: resp}
955	return
956}
957
958// listAlertsNextResults retrieves the next set of results, if any.
959func (client ServicesClient) listAlertsNextResults(ctx context.Context, lastResults Alerts) (result Alerts, err error) {
960	req, err := lastResults.alertsPreparer(ctx)
961	if err != nil {
962		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listAlertsNextResults", nil, "Failure preparing next results request")
963	}
964	if req == nil {
965		return
966	}
967	resp, err := client.ListAlertsSender(req)
968	if err != nil {
969		result.Response = autorest.Response{Response: resp}
970		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listAlertsNextResults", resp, "Failure sending next results request")
971	}
972	result, err = client.ListAlertsResponder(resp)
973	if err != nil {
974		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listAlertsNextResults", resp, "Failure responding to next results request")
975	}
976	return
977}
978
979// ListAlertsComplete enumerates all values, automatically crossing page boundaries as required.
980func (client ServicesClient) ListAlertsComplete(ctx context.Context, serviceName string, filter string, state string, from *date.Time, toParameter *date.Time) (result AlertsIterator, err error) {
981	if tracing.IsEnabled() {
982		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListAlerts")
983		defer func() {
984			sc := -1
985			if result.Response().Response.Response != nil {
986				sc = result.page.Response().Response.Response.StatusCode
987			}
988			tracing.EndSpan(ctx, sc, err)
989		}()
990	}
991	result.page, err = client.ListAlerts(ctx, serviceName, filter, state, from, toParameter)
992	return
993}
994
995// ListAllRiskyIPDownloadReport gets all Risky IP report URIs for the last 7 days.
996// Parameters:
997// serviceName - the name of the service.
998func (client ServicesClient) ListAllRiskyIPDownloadReport(ctx context.Context, serviceName string) (result RiskyIPBlobUris, err error) {
999	if tracing.IsEnabled() {
1000		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListAllRiskyIPDownloadReport")
1001		defer func() {
1002			sc := -1
1003			if result.Response.Response != nil {
1004				sc = result.Response.Response.StatusCode
1005			}
1006			tracing.EndSpan(ctx, sc, err)
1007		}()
1008	}
1009	req, err := client.ListAllRiskyIPDownloadReportPreparer(ctx, serviceName)
1010	if err != nil {
1011		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListAllRiskyIPDownloadReport", nil, "Failure preparing request")
1012		return
1013	}
1014
1015	resp, err := client.ListAllRiskyIPDownloadReportSender(req)
1016	if err != nil {
1017		result.Response = autorest.Response{Response: resp}
1018		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListAllRiskyIPDownloadReport", resp, "Failure sending request")
1019		return
1020	}
1021
1022	result, err = client.ListAllRiskyIPDownloadReportResponder(resp)
1023	if err != nil {
1024		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListAllRiskyIPDownloadReport", resp, "Failure responding to request")
1025	}
1026
1027	return
1028}
1029
1030// ListAllRiskyIPDownloadReportPreparer prepares the ListAllRiskyIPDownloadReport request.
1031func (client ServicesClient) ListAllRiskyIPDownloadReportPreparer(ctx context.Context, serviceName string) (*http.Request, error) {
1032	pathParameters := map[string]interface{}{
1033		"serviceName": autorest.Encode("path", serviceName),
1034	}
1035
1036	const APIVersion = "2014-01-01"
1037	queryParameters := map[string]interface{}{
1038		"api-version": APIVersion,
1039	}
1040
1041	preparer := autorest.CreatePreparer(
1042		autorest.AsGet(),
1043		autorest.WithBaseURL(client.BaseURI),
1044		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/reports/riskyIp/blobUris", pathParameters),
1045		autorest.WithQueryParameters(queryParameters))
1046	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1047}
1048
1049// ListAllRiskyIPDownloadReportSender sends the ListAllRiskyIPDownloadReport request. The method will close the
1050// http.Response Body if it receives an error.
1051func (client ServicesClient) ListAllRiskyIPDownloadReportSender(req *http.Request) (*http.Response, error) {
1052	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1053	return autorest.SendWithSender(client, req, sd...)
1054}
1055
1056// ListAllRiskyIPDownloadReportResponder handles the response to the ListAllRiskyIPDownloadReport request. The method always
1057// closes the http.Response Body.
1058func (client ServicesClient) ListAllRiskyIPDownloadReportResponder(resp *http.Response) (result RiskyIPBlobUris, err error) {
1059	err = autorest.Respond(
1060		resp,
1061		client.ByInspecting(),
1062		azure.WithErrorUnlessStatusCode(http.StatusOK),
1063		autorest.ByUnmarshallingJSON(&result),
1064		autorest.ByClosing())
1065	result.Response = autorest.Response{Response: resp}
1066	return
1067}
1068
1069// ListCurrentRiskyIPDownloadReport initiate the generation of a new Risky IP report. Returns the URI for the new one.
1070// Parameters:
1071// serviceName - the name of the service.
1072func (client ServicesClient) ListCurrentRiskyIPDownloadReport(ctx context.Context, serviceName string) (result RiskyIPBlobUris, err error) {
1073	if tracing.IsEnabled() {
1074		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListCurrentRiskyIPDownloadReport")
1075		defer func() {
1076			sc := -1
1077			if result.Response.Response != nil {
1078				sc = result.Response.Response.StatusCode
1079			}
1080			tracing.EndSpan(ctx, sc, err)
1081		}()
1082	}
1083	req, err := client.ListCurrentRiskyIPDownloadReportPreparer(ctx, serviceName)
1084	if err != nil {
1085		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListCurrentRiskyIPDownloadReport", nil, "Failure preparing request")
1086		return
1087	}
1088
1089	resp, err := client.ListCurrentRiskyIPDownloadReportSender(req)
1090	if err != nil {
1091		result.Response = autorest.Response{Response: resp}
1092		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListCurrentRiskyIPDownloadReport", resp, "Failure sending request")
1093		return
1094	}
1095
1096	result, err = client.ListCurrentRiskyIPDownloadReportResponder(resp)
1097	if err != nil {
1098		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListCurrentRiskyIPDownloadReport", resp, "Failure responding to request")
1099	}
1100
1101	return
1102}
1103
1104// ListCurrentRiskyIPDownloadReportPreparer prepares the ListCurrentRiskyIPDownloadReport request.
1105func (client ServicesClient) ListCurrentRiskyIPDownloadReportPreparer(ctx context.Context, serviceName string) (*http.Request, error) {
1106	pathParameters := map[string]interface{}{
1107		"serviceName": autorest.Encode("path", serviceName),
1108	}
1109
1110	const APIVersion = "2014-01-01"
1111	queryParameters := map[string]interface{}{
1112		"api-version": APIVersion,
1113	}
1114
1115	preparer := autorest.CreatePreparer(
1116		autorest.AsPost(),
1117		autorest.WithBaseURL(client.BaseURI),
1118		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/reports/riskyIp/generateBlobUri", pathParameters),
1119		autorest.WithQueryParameters(queryParameters))
1120	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1121}
1122
1123// ListCurrentRiskyIPDownloadReportSender sends the ListCurrentRiskyIPDownloadReport request. The method will close the
1124// http.Response Body if it receives an error.
1125func (client ServicesClient) ListCurrentRiskyIPDownloadReportSender(req *http.Request) (*http.Response, error) {
1126	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1127	return autorest.SendWithSender(client, req, sd...)
1128}
1129
1130// ListCurrentRiskyIPDownloadReportResponder handles the response to the ListCurrentRiskyIPDownloadReport request. The method always
1131// closes the http.Response Body.
1132func (client ServicesClient) ListCurrentRiskyIPDownloadReportResponder(resp *http.Response) (result RiskyIPBlobUris, err error) {
1133	err = autorest.Respond(
1134		resp,
1135		client.ByInspecting(),
1136		azure.WithErrorUnlessStatusCode(http.StatusOK),
1137		autorest.ByUnmarshallingJSON(&result),
1138		autorest.ByClosing())
1139	result.Response = autorest.Response{Response: resp}
1140	return
1141}
1142
1143// ListExportErrors gets the count of latest AAD export errors.
1144// Parameters:
1145// serviceName - the name of the service.
1146func (client ServicesClient) ListExportErrors(ctx context.Context, serviceName string) (result ErrorCounts, err error) {
1147	if tracing.IsEnabled() {
1148		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListExportErrors")
1149		defer func() {
1150			sc := -1
1151			if result.Response.Response != nil {
1152				sc = result.Response.Response.StatusCode
1153			}
1154			tracing.EndSpan(ctx, sc, err)
1155		}()
1156	}
1157	req, err := client.ListExportErrorsPreparer(ctx, serviceName)
1158	if err != nil {
1159		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListExportErrors", nil, "Failure preparing request")
1160		return
1161	}
1162
1163	resp, err := client.ListExportErrorsSender(req)
1164	if err != nil {
1165		result.Response = autorest.Response{Response: resp}
1166		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListExportErrors", resp, "Failure sending request")
1167		return
1168	}
1169
1170	result, err = client.ListExportErrorsResponder(resp)
1171	if err != nil {
1172		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListExportErrors", resp, "Failure responding to request")
1173	}
1174
1175	return
1176}
1177
1178// ListExportErrorsPreparer prepares the ListExportErrors request.
1179func (client ServicesClient) ListExportErrorsPreparer(ctx context.Context, serviceName string) (*http.Request, error) {
1180	pathParameters := map[string]interface{}{
1181		"serviceName": autorest.Encode("path", serviceName),
1182	}
1183
1184	const APIVersion = "2014-01-01"
1185	queryParameters := map[string]interface{}{
1186		"api-version": APIVersion,
1187	}
1188
1189	preparer := autorest.CreatePreparer(
1190		autorest.AsGet(),
1191		autorest.WithBaseURL(client.BaseURI),
1192		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/exporterrors/counts", pathParameters),
1193		autorest.WithQueryParameters(queryParameters))
1194	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1195}
1196
1197// ListExportErrorsSender sends the ListExportErrors request. The method will close the
1198// http.Response Body if it receives an error.
1199func (client ServicesClient) ListExportErrorsSender(req *http.Request) (*http.Response, error) {
1200	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1201	return autorest.SendWithSender(client, req, sd...)
1202}
1203
1204// ListExportErrorsResponder handles the response to the ListExportErrors request. The method always
1205// closes the http.Response Body.
1206func (client ServicesClient) ListExportErrorsResponder(resp *http.Response) (result ErrorCounts, err error) {
1207	err = autorest.Respond(
1208		resp,
1209		client.ByInspecting(),
1210		azure.WithErrorUnlessStatusCode(http.StatusOK),
1211		autorest.ByUnmarshallingJSON(&result),
1212		autorest.ByClosing())
1213	result.Response = autorest.Response{Response: resp}
1214	return
1215}
1216
1217// ListExportErrorsV2 gets the categorized export errors.
1218// Parameters:
1219// serviceName - the name of the service.
1220// errorBucket - the error category to query for.
1221func (client ServicesClient) ListExportErrorsV2(ctx context.Context, serviceName string, errorBucket string) (result MergedExportErrors, err error) {
1222	if tracing.IsEnabled() {
1223		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListExportErrorsV2")
1224		defer func() {
1225			sc := -1
1226			if result.Response.Response != nil {
1227				sc = result.Response.Response.StatusCode
1228			}
1229			tracing.EndSpan(ctx, sc, err)
1230		}()
1231	}
1232	req, err := client.ListExportErrorsV2Preparer(ctx, serviceName, errorBucket)
1233	if err != nil {
1234		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListExportErrorsV2", nil, "Failure preparing request")
1235		return
1236	}
1237
1238	resp, err := client.ListExportErrorsV2Sender(req)
1239	if err != nil {
1240		result.Response = autorest.Response{Response: resp}
1241		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListExportErrorsV2", resp, "Failure sending request")
1242		return
1243	}
1244
1245	result, err = client.ListExportErrorsV2Responder(resp)
1246	if err != nil {
1247		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListExportErrorsV2", resp, "Failure responding to request")
1248	}
1249
1250	return
1251}
1252
1253// ListExportErrorsV2Preparer prepares the ListExportErrorsV2 request.
1254func (client ServicesClient) ListExportErrorsV2Preparer(ctx context.Context, serviceName string, errorBucket string) (*http.Request, error) {
1255	pathParameters := map[string]interface{}{
1256		"serviceName": autorest.Encode("path", serviceName),
1257	}
1258
1259	const APIVersion = "2014-01-01"
1260	queryParameters := map[string]interface{}{
1261		"api-version": APIVersion,
1262		"errorBucket": autorest.Encode("query", errorBucket),
1263	}
1264
1265	preparer := autorest.CreatePreparer(
1266		autorest.AsGet(),
1267		autorest.WithBaseURL(client.BaseURI),
1268		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/exporterrors/listV2", pathParameters),
1269		autorest.WithQueryParameters(queryParameters))
1270	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1271}
1272
1273// ListExportErrorsV2Sender sends the ListExportErrorsV2 request. The method will close the
1274// http.Response Body if it receives an error.
1275func (client ServicesClient) ListExportErrorsV2Sender(req *http.Request) (*http.Response, error) {
1276	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1277	return autorest.SendWithSender(client, req, sd...)
1278}
1279
1280// ListExportErrorsV2Responder handles the response to the ListExportErrorsV2 request. The method always
1281// closes the http.Response Body.
1282func (client ServicesClient) ListExportErrorsV2Responder(resp *http.Response) (result MergedExportErrors, err error) {
1283	err = autorest.Respond(
1284		resp,
1285		client.ByInspecting(),
1286		azure.WithErrorUnlessStatusCode(http.StatusOK),
1287		autorest.ByUnmarshallingJSON(&result),
1288		autorest.ByClosing())
1289	result.Response = autorest.Response{Response: resp}
1290	return
1291}
1292
1293// ListExportStatus gets the export status.
1294// Parameters:
1295// serviceName - the name of the service.
1296func (client ServicesClient) ListExportStatus(ctx context.Context, serviceName string) (result ExportStatusesPage, err error) {
1297	if tracing.IsEnabled() {
1298		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListExportStatus")
1299		defer func() {
1300			sc := -1
1301			if result.es.Response.Response != nil {
1302				sc = result.es.Response.Response.StatusCode
1303			}
1304			tracing.EndSpan(ctx, sc, err)
1305		}()
1306	}
1307	result.fn = client.listExportStatusNextResults
1308	req, err := client.ListExportStatusPreparer(ctx, serviceName)
1309	if err != nil {
1310		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListExportStatus", nil, "Failure preparing request")
1311		return
1312	}
1313
1314	resp, err := client.ListExportStatusSender(req)
1315	if err != nil {
1316		result.es.Response = autorest.Response{Response: resp}
1317		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListExportStatus", resp, "Failure sending request")
1318		return
1319	}
1320
1321	result.es, err = client.ListExportStatusResponder(resp)
1322	if err != nil {
1323		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListExportStatus", resp, "Failure responding to request")
1324	}
1325
1326	return
1327}
1328
1329// ListExportStatusPreparer prepares the ListExportStatus request.
1330func (client ServicesClient) ListExportStatusPreparer(ctx context.Context, serviceName string) (*http.Request, error) {
1331	pathParameters := map[string]interface{}{
1332		"serviceName": autorest.Encode("path", serviceName),
1333	}
1334
1335	const APIVersion = "2014-01-01"
1336	queryParameters := map[string]interface{}{
1337		"api-version": APIVersion,
1338	}
1339
1340	preparer := autorest.CreatePreparer(
1341		autorest.AsGet(),
1342		autorest.WithBaseURL(client.BaseURI),
1343		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/exportstatus", pathParameters),
1344		autorest.WithQueryParameters(queryParameters))
1345	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1346}
1347
1348// ListExportStatusSender sends the ListExportStatus request. The method will close the
1349// http.Response Body if it receives an error.
1350func (client ServicesClient) ListExportStatusSender(req *http.Request) (*http.Response, error) {
1351	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1352	return autorest.SendWithSender(client, req, sd...)
1353}
1354
1355// ListExportStatusResponder handles the response to the ListExportStatus request. The method always
1356// closes the http.Response Body.
1357func (client ServicesClient) ListExportStatusResponder(resp *http.Response) (result ExportStatuses, err error) {
1358	err = autorest.Respond(
1359		resp,
1360		client.ByInspecting(),
1361		azure.WithErrorUnlessStatusCode(http.StatusOK),
1362		autorest.ByUnmarshallingJSON(&result),
1363		autorest.ByClosing())
1364	result.Response = autorest.Response{Response: resp}
1365	return
1366}
1367
1368// listExportStatusNextResults retrieves the next set of results, if any.
1369func (client ServicesClient) listExportStatusNextResults(ctx context.Context, lastResults ExportStatuses) (result ExportStatuses, err error) {
1370	req, err := lastResults.exportStatusesPreparer(ctx)
1371	if err != nil {
1372		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listExportStatusNextResults", nil, "Failure preparing next results request")
1373	}
1374	if req == nil {
1375		return
1376	}
1377	resp, err := client.ListExportStatusSender(req)
1378	if err != nil {
1379		result.Response = autorest.Response{Response: resp}
1380		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listExportStatusNextResults", resp, "Failure sending next results request")
1381	}
1382	result, err = client.ListExportStatusResponder(resp)
1383	if err != nil {
1384		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listExportStatusNextResults", resp, "Failure responding to next results request")
1385	}
1386	return
1387}
1388
1389// ListExportStatusComplete enumerates all values, automatically crossing page boundaries as required.
1390func (client ServicesClient) ListExportStatusComplete(ctx context.Context, serviceName string) (result ExportStatusesIterator, err error) {
1391	if tracing.IsEnabled() {
1392		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListExportStatus")
1393		defer func() {
1394			sc := -1
1395			if result.Response().Response.Response != nil {
1396				sc = result.page.Response().Response.Response.StatusCode
1397			}
1398			tracing.EndSpan(ctx, sc, err)
1399		}()
1400	}
1401	result.page, err = client.ListExportStatus(ctx, serviceName)
1402	return
1403}
1404
1405// ListMetricMetadata gets the service related metrics information.
1406// Parameters:
1407// serviceName - the name of the service.
1408// filter - the metric metadata property filter to apply.
1409// perfCounter - indicates if only performance counter metrics are requested.
1410func (client ServicesClient) ListMetricMetadata(ctx context.Context, serviceName string, filter string, perfCounter *bool) (result MetricMetadataListPage, err error) {
1411	if tracing.IsEnabled() {
1412		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListMetricMetadata")
1413		defer func() {
1414			sc := -1
1415			if result.mml.Response.Response != nil {
1416				sc = result.mml.Response.Response.StatusCode
1417			}
1418			tracing.EndSpan(ctx, sc, err)
1419		}()
1420	}
1421	result.fn = client.listMetricMetadataNextResults
1422	req, err := client.ListMetricMetadataPreparer(ctx, serviceName, filter, perfCounter)
1423	if err != nil {
1424		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListMetricMetadata", nil, "Failure preparing request")
1425		return
1426	}
1427
1428	resp, err := client.ListMetricMetadataSender(req)
1429	if err != nil {
1430		result.mml.Response = autorest.Response{Response: resp}
1431		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListMetricMetadata", resp, "Failure sending request")
1432		return
1433	}
1434
1435	result.mml, err = client.ListMetricMetadataResponder(resp)
1436	if err != nil {
1437		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListMetricMetadata", resp, "Failure responding to request")
1438	}
1439
1440	return
1441}
1442
1443// ListMetricMetadataPreparer prepares the ListMetricMetadata request.
1444func (client ServicesClient) ListMetricMetadataPreparer(ctx context.Context, serviceName string, filter string, perfCounter *bool) (*http.Request, error) {
1445	pathParameters := map[string]interface{}{
1446		"serviceName": autorest.Encode("path", serviceName),
1447	}
1448
1449	const APIVersion = "2014-01-01"
1450	queryParameters := map[string]interface{}{
1451		"api-version": APIVersion,
1452	}
1453	if len(filter) > 0 {
1454		queryParameters["$filter"] = autorest.Encode("query", filter)
1455	}
1456	if perfCounter != nil {
1457		queryParameters["perfCounter"] = autorest.Encode("query", *perfCounter)
1458	}
1459
1460	preparer := autorest.CreatePreparer(
1461		autorest.AsGet(),
1462		autorest.WithBaseURL(client.BaseURI),
1463		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/metricmetadata", pathParameters),
1464		autorest.WithQueryParameters(queryParameters))
1465	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1466}
1467
1468// ListMetricMetadataSender sends the ListMetricMetadata request. The method will close the
1469// http.Response Body if it receives an error.
1470func (client ServicesClient) ListMetricMetadataSender(req *http.Request) (*http.Response, error) {
1471	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1472	return autorest.SendWithSender(client, req, sd...)
1473}
1474
1475// ListMetricMetadataResponder handles the response to the ListMetricMetadata request. The method always
1476// closes the http.Response Body.
1477func (client ServicesClient) ListMetricMetadataResponder(resp *http.Response) (result MetricMetadataList, err error) {
1478	err = autorest.Respond(
1479		resp,
1480		client.ByInspecting(),
1481		azure.WithErrorUnlessStatusCode(http.StatusOK),
1482		autorest.ByUnmarshallingJSON(&result),
1483		autorest.ByClosing())
1484	result.Response = autorest.Response{Response: resp}
1485	return
1486}
1487
1488// listMetricMetadataNextResults retrieves the next set of results, if any.
1489func (client ServicesClient) listMetricMetadataNextResults(ctx context.Context, lastResults MetricMetadataList) (result MetricMetadataList, err error) {
1490	req, err := lastResults.metricMetadataListPreparer(ctx)
1491	if err != nil {
1492		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listMetricMetadataNextResults", nil, "Failure preparing next results request")
1493	}
1494	if req == nil {
1495		return
1496	}
1497	resp, err := client.ListMetricMetadataSender(req)
1498	if err != nil {
1499		result.Response = autorest.Response{Response: resp}
1500		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listMetricMetadataNextResults", resp, "Failure sending next results request")
1501	}
1502	result, err = client.ListMetricMetadataResponder(resp)
1503	if err != nil {
1504		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listMetricMetadataNextResults", resp, "Failure responding to next results request")
1505	}
1506	return
1507}
1508
1509// ListMetricMetadataComplete enumerates all values, automatically crossing page boundaries as required.
1510func (client ServicesClient) ListMetricMetadataComplete(ctx context.Context, serviceName string, filter string, perfCounter *bool) (result MetricMetadataListIterator, err error) {
1511	if tracing.IsEnabled() {
1512		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListMetricMetadata")
1513		defer func() {
1514			sc := -1
1515			if result.Response().Response.Response != nil {
1516				sc = result.page.Response().Response.Response.StatusCode
1517			}
1518			tracing.EndSpan(ctx, sc, err)
1519		}()
1520	}
1521	result.page, err = client.ListMetricMetadata(ctx, serviceName, filter, perfCounter)
1522	return
1523}
1524
1525// ListMetricsAverage gets the average of the metric values for a given metric and group combination.
1526// Parameters:
1527// serviceName - the name of the service.
1528// metricName - the metric name
1529// groupName - the group name
1530func (client ServicesClient) ListMetricsAverage(ctx context.Context, serviceName string, metricName string, groupName string) (result MetricsPage, err error) {
1531	if tracing.IsEnabled() {
1532		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListMetricsAverage")
1533		defer func() {
1534			sc := -1
1535			if result.mVar.Response.Response != nil {
1536				sc = result.mVar.Response.Response.StatusCode
1537			}
1538			tracing.EndSpan(ctx, sc, err)
1539		}()
1540	}
1541	result.fn = client.listMetricsAverageNextResults
1542	req, err := client.ListMetricsAveragePreparer(ctx, serviceName, metricName, groupName)
1543	if err != nil {
1544		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListMetricsAverage", nil, "Failure preparing request")
1545		return
1546	}
1547
1548	resp, err := client.ListMetricsAverageSender(req)
1549	if err != nil {
1550		result.mVar.Response = autorest.Response{Response: resp}
1551		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListMetricsAverage", resp, "Failure sending request")
1552		return
1553	}
1554
1555	result.mVar, err = client.ListMetricsAverageResponder(resp)
1556	if err != nil {
1557		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListMetricsAverage", resp, "Failure responding to request")
1558	}
1559
1560	return
1561}
1562
1563// ListMetricsAveragePreparer prepares the ListMetricsAverage request.
1564func (client ServicesClient) ListMetricsAveragePreparer(ctx context.Context, serviceName string, metricName string, groupName string) (*http.Request, error) {
1565	pathParameters := map[string]interface{}{
1566		"groupName":   autorest.Encode("path", groupName),
1567		"metricName":  autorest.Encode("path", metricName),
1568		"serviceName": autorest.Encode("path", serviceName),
1569	}
1570
1571	const APIVersion = "2014-01-01"
1572	queryParameters := map[string]interface{}{
1573		"api-version": APIVersion,
1574	}
1575
1576	preparer := autorest.CreatePreparer(
1577		autorest.AsGet(),
1578		autorest.WithBaseURL(client.BaseURI),
1579		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/metrics/{metricName}/groups/{groupName}/average", pathParameters),
1580		autorest.WithQueryParameters(queryParameters))
1581	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1582}
1583
1584// ListMetricsAverageSender sends the ListMetricsAverage request. The method will close the
1585// http.Response Body if it receives an error.
1586func (client ServicesClient) ListMetricsAverageSender(req *http.Request) (*http.Response, error) {
1587	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1588	return autorest.SendWithSender(client, req, sd...)
1589}
1590
1591// ListMetricsAverageResponder handles the response to the ListMetricsAverage request. The method always
1592// closes the http.Response Body.
1593func (client ServicesClient) ListMetricsAverageResponder(resp *http.Response) (result Metrics, err error) {
1594	err = autorest.Respond(
1595		resp,
1596		client.ByInspecting(),
1597		azure.WithErrorUnlessStatusCode(http.StatusOK),
1598		autorest.ByUnmarshallingJSON(&result),
1599		autorest.ByClosing())
1600	result.Response = autorest.Response{Response: resp}
1601	return
1602}
1603
1604// listMetricsAverageNextResults retrieves the next set of results, if any.
1605func (client ServicesClient) listMetricsAverageNextResults(ctx context.Context, lastResults Metrics) (result Metrics, err error) {
1606	req, err := lastResults.metricsPreparer(ctx)
1607	if err != nil {
1608		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listMetricsAverageNextResults", nil, "Failure preparing next results request")
1609	}
1610	if req == nil {
1611		return
1612	}
1613	resp, err := client.ListMetricsAverageSender(req)
1614	if err != nil {
1615		result.Response = autorest.Response{Response: resp}
1616		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listMetricsAverageNextResults", resp, "Failure sending next results request")
1617	}
1618	result, err = client.ListMetricsAverageResponder(resp)
1619	if err != nil {
1620		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listMetricsAverageNextResults", resp, "Failure responding to next results request")
1621	}
1622	return
1623}
1624
1625// ListMetricsAverageComplete enumerates all values, automatically crossing page boundaries as required.
1626func (client ServicesClient) ListMetricsAverageComplete(ctx context.Context, serviceName string, metricName string, groupName string) (result MetricsIterator, err error) {
1627	if tracing.IsEnabled() {
1628		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListMetricsAverage")
1629		defer func() {
1630			sc := -1
1631			if result.Response().Response.Response != nil {
1632				sc = result.page.Response().Response.Response.StatusCode
1633			}
1634			tracing.EndSpan(ctx, sc, err)
1635		}()
1636	}
1637	result.page, err = client.ListMetricsAverage(ctx, serviceName, metricName, groupName)
1638	return
1639}
1640
1641// ListMetricsSum gets the sum of the metric values for a given metric and group combination.
1642// Parameters:
1643// serviceName - the name of the service.
1644// metricName - the metric name
1645// groupName - the group name
1646func (client ServicesClient) ListMetricsSum(ctx context.Context, serviceName string, metricName string, groupName string) (result MetricsPage, err error) {
1647	if tracing.IsEnabled() {
1648		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListMetricsSum")
1649		defer func() {
1650			sc := -1
1651			if result.mVar.Response.Response != nil {
1652				sc = result.mVar.Response.Response.StatusCode
1653			}
1654			tracing.EndSpan(ctx, sc, err)
1655		}()
1656	}
1657	result.fn = client.listMetricsSumNextResults
1658	req, err := client.ListMetricsSumPreparer(ctx, serviceName, metricName, groupName)
1659	if err != nil {
1660		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListMetricsSum", nil, "Failure preparing request")
1661		return
1662	}
1663
1664	resp, err := client.ListMetricsSumSender(req)
1665	if err != nil {
1666		result.mVar.Response = autorest.Response{Response: resp}
1667		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListMetricsSum", resp, "Failure sending request")
1668		return
1669	}
1670
1671	result.mVar, err = client.ListMetricsSumResponder(resp)
1672	if err != nil {
1673		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListMetricsSum", resp, "Failure responding to request")
1674	}
1675
1676	return
1677}
1678
1679// ListMetricsSumPreparer prepares the ListMetricsSum request.
1680func (client ServicesClient) ListMetricsSumPreparer(ctx context.Context, serviceName string, metricName string, groupName string) (*http.Request, error) {
1681	pathParameters := map[string]interface{}{
1682		"groupName":   autorest.Encode("path", groupName),
1683		"metricName":  autorest.Encode("path", metricName),
1684		"serviceName": autorest.Encode("path", serviceName),
1685	}
1686
1687	const APIVersion = "2014-01-01"
1688	queryParameters := map[string]interface{}{
1689		"api-version": APIVersion,
1690	}
1691
1692	preparer := autorest.CreatePreparer(
1693		autorest.AsGet(),
1694		autorest.WithBaseURL(client.BaseURI),
1695		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/metrics/{metricName}/groups/{groupName}/sum", pathParameters),
1696		autorest.WithQueryParameters(queryParameters))
1697	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1698}
1699
1700// ListMetricsSumSender sends the ListMetricsSum request. The method will close the
1701// http.Response Body if it receives an error.
1702func (client ServicesClient) ListMetricsSumSender(req *http.Request) (*http.Response, error) {
1703	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1704	return autorest.SendWithSender(client, req, sd...)
1705}
1706
1707// ListMetricsSumResponder handles the response to the ListMetricsSum request. The method always
1708// closes the http.Response Body.
1709func (client ServicesClient) ListMetricsSumResponder(resp *http.Response) (result Metrics, err error) {
1710	err = autorest.Respond(
1711		resp,
1712		client.ByInspecting(),
1713		azure.WithErrorUnlessStatusCode(http.StatusOK),
1714		autorest.ByUnmarshallingJSON(&result),
1715		autorest.ByClosing())
1716	result.Response = autorest.Response{Response: resp}
1717	return
1718}
1719
1720// listMetricsSumNextResults retrieves the next set of results, if any.
1721func (client ServicesClient) listMetricsSumNextResults(ctx context.Context, lastResults Metrics) (result Metrics, err error) {
1722	req, err := lastResults.metricsPreparer(ctx)
1723	if err != nil {
1724		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listMetricsSumNextResults", nil, "Failure preparing next results request")
1725	}
1726	if req == nil {
1727		return
1728	}
1729	resp, err := client.ListMetricsSumSender(req)
1730	if err != nil {
1731		result.Response = autorest.Response{Response: resp}
1732		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listMetricsSumNextResults", resp, "Failure sending next results request")
1733	}
1734	result, err = client.ListMetricsSumResponder(resp)
1735	if err != nil {
1736		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listMetricsSumNextResults", resp, "Failure responding to next results request")
1737	}
1738	return
1739}
1740
1741// ListMetricsSumComplete enumerates all values, automatically crossing page boundaries as required.
1742func (client ServicesClient) ListMetricsSumComplete(ctx context.Context, serviceName string, metricName string, groupName string) (result MetricsIterator, err error) {
1743	if tracing.IsEnabled() {
1744		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListMetricsSum")
1745		defer func() {
1746			sc := -1
1747			if result.Response().Response.Response != nil {
1748				sc = result.page.Response().Response.Response.StatusCode
1749			}
1750			tracing.EndSpan(ctx, sc, err)
1751		}()
1752	}
1753	result.page, err = client.ListMetricsSum(ctx, serviceName, metricName, groupName)
1754	return
1755}
1756
1757// ListMonitoringConfigurations gets the service level monitoring configurations.
1758// Parameters:
1759// serviceName - the name of the service.
1760func (client ServicesClient) ListMonitoringConfigurations(ctx context.Context, serviceName string) (result Items, err error) {
1761	if tracing.IsEnabled() {
1762		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListMonitoringConfigurations")
1763		defer func() {
1764			sc := -1
1765			if result.Response.Response != nil {
1766				sc = result.Response.Response.StatusCode
1767			}
1768			tracing.EndSpan(ctx, sc, err)
1769		}()
1770	}
1771	req, err := client.ListMonitoringConfigurationsPreparer(ctx, serviceName)
1772	if err != nil {
1773		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListMonitoringConfigurations", nil, "Failure preparing request")
1774		return
1775	}
1776
1777	resp, err := client.ListMonitoringConfigurationsSender(req)
1778	if err != nil {
1779		result.Response = autorest.Response{Response: resp}
1780		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListMonitoringConfigurations", resp, "Failure sending request")
1781		return
1782	}
1783
1784	result, err = client.ListMonitoringConfigurationsResponder(resp)
1785	if err != nil {
1786		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListMonitoringConfigurations", resp, "Failure responding to request")
1787	}
1788
1789	return
1790}
1791
1792// ListMonitoringConfigurationsPreparer prepares the ListMonitoringConfigurations request.
1793func (client ServicesClient) ListMonitoringConfigurationsPreparer(ctx context.Context, serviceName string) (*http.Request, error) {
1794	pathParameters := map[string]interface{}{
1795		"serviceName": autorest.Encode("path", serviceName),
1796	}
1797
1798	const APIVersion = "2014-01-01"
1799	queryParameters := map[string]interface{}{
1800		"api-version": APIVersion,
1801	}
1802
1803	preparer := autorest.CreatePreparer(
1804		autorest.AsGet(),
1805		autorest.WithBaseURL(client.BaseURI),
1806		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/monitoringconfigurations", pathParameters),
1807		autorest.WithQueryParameters(queryParameters))
1808	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1809}
1810
1811// ListMonitoringConfigurationsSender sends the ListMonitoringConfigurations request. The method will close the
1812// http.Response Body if it receives an error.
1813func (client ServicesClient) ListMonitoringConfigurationsSender(req *http.Request) (*http.Response, error) {
1814	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1815	return autorest.SendWithSender(client, req, sd...)
1816}
1817
1818// ListMonitoringConfigurationsResponder handles the response to the ListMonitoringConfigurations request. The method always
1819// closes the http.Response Body.
1820func (client ServicesClient) ListMonitoringConfigurationsResponder(resp *http.Response) (result Items, err error) {
1821	err = autorest.Respond(
1822		resp,
1823		client.ByInspecting(),
1824		azure.WithErrorUnlessStatusCode(http.StatusOK),
1825		autorest.ByUnmarshallingJSON(&result),
1826		autorest.ByClosing())
1827	result.Response = autorest.Response{Response: resp}
1828	return
1829}
1830
1831// ListPremium gets the details of services for a tenant having Azure AD Premium license and is onboarded to Azure
1832// Active Directory Connect Health.
1833// Parameters:
1834// filter - the service property filter to apply.
1835// serviceType - the service type for the services onboarded to Azure Active Directory Connect Health.
1836// Depending on whether the service is monitoring, ADFS, Sync or ADDS roles, the service type can either be
1837// AdFederationService or AadSyncService or AdDomainService.
1838// skipCount - the skip count, which specifies the number of elements that can be bypassed from a sequence and
1839// then return the remaining elements.
1840// takeCount - the take count , which specifies the number of elements that can be returned from a sequence.
1841func (client ServicesClient) ListPremium(ctx context.Context, filter string, serviceType string, skipCount *int32, takeCount *int32) (result ServicesPage, err error) {
1842	if tracing.IsEnabled() {
1843		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListPremium")
1844		defer func() {
1845			sc := -1
1846			if result.s.Response.Response != nil {
1847				sc = result.s.Response.Response.StatusCode
1848			}
1849			tracing.EndSpan(ctx, sc, err)
1850		}()
1851	}
1852	result.fn = client.listPremiumNextResults
1853	req, err := client.ListPremiumPreparer(ctx, filter, serviceType, skipCount, takeCount)
1854	if err != nil {
1855		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListPremium", nil, "Failure preparing request")
1856		return
1857	}
1858
1859	resp, err := client.ListPremiumSender(req)
1860	if err != nil {
1861		result.s.Response = autorest.Response{Response: resp}
1862		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListPremium", resp, "Failure sending request")
1863		return
1864	}
1865
1866	result.s, err = client.ListPremiumResponder(resp)
1867	if err != nil {
1868		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListPremium", resp, "Failure responding to request")
1869	}
1870
1871	return
1872}
1873
1874// ListPremiumPreparer prepares the ListPremium request.
1875func (client ServicesClient) ListPremiumPreparer(ctx context.Context, filter string, serviceType string, skipCount *int32, takeCount *int32) (*http.Request, error) {
1876	const APIVersion = "2014-01-01"
1877	queryParameters := map[string]interface{}{
1878		"api-version": APIVersion,
1879	}
1880	if len(filter) > 0 {
1881		queryParameters["$filter"] = autorest.Encode("query", filter)
1882	}
1883	if len(serviceType) > 0 {
1884		queryParameters["serviceType"] = autorest.Encode("query", serviceType)
1885	}
1886	if skipCount != nil {
1887		queryParameters["skipCount"] = autorest.Encode("query", *skipCount)
1888	}
1889	if takeCount != nil {
1890		queryParameters["takeCount"] = autorest.Encode("query", *takeCount)
1891	}
1892
1893	preparer := autorest.CreatePreparer(
1894		autorest.AsGet(),
1895		autorest.WithBaseURL(client.BaseURI),
1896		autorest.WithPath("/providers/Microsoft.ADHybridHealthService/services/premiumCheck"),
1897		autorest.WithQueryParameters(queryParameters))
1898	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1899}
1900
1901// ListPremiumSender sends the ListPremium request. The method will close the
1902// http.Response Body if it receives an error.
1903func (client ServicesClient) ListPremiumSender(req *http.Request) (*http.Response, error) {
1904	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1905	return autorest.SendWithSender(client, req, sd...)
1906}
1907
1908// ListPremiumResponder handles the response to the ListPremium request. The method always
1909// closes the http.Response Body.
1910func (client ServicesClient) ListPremiumResponder(resp *http.Response) (result Services, err error) {
1911	err = autorest.Respond(
1912		resp,
1913		client.ByInspecting(),
1914		azure.WithErrorUnlessStatusCode(http.StatusOK),
1915		autorest.ByUnmarshallingJSON(&result),
1916		autorest.ByClosing())
1917	result.Response = autorest.Response{Response: resp}
1918	return
1919}
1920
1921// listPremiumNextResults retrieves the next set of results, if any.
1922func (client ServicesClient) listPremiumNextResults(ctx context.Context, lastResults Services) (result Services, err error) {
1923	req, err := lastResults.servicesPreparer(ctx)
1924	if err != nil {
1925		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listPremiumNextResults", nil, "Failure preparing next results request")
1926	}
1927	if req == nil {
1928		return
1929	}
1930	resp, err := client.ListPremiumSender(req)
1931	if err != nil {
1932		result.Response = autorest.Response{Response: resp}
1933		return result, autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listPremiumNextResults", resp, "Failure sending next results request")
1934	}
1935	result, err = client.ListPremiumResponder(resp)
1936	if err != nil {
1937		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "listPremiumNextResults", resp, "Failure responding to next results request")
1938	}
1939	return
1940}
1941
1942// ListPremiumComplete enumerates all values, automatically crossing page boundaries as required.
1943func (client ServicesClient) ListPremiumComplete(ctx context.Context, filter string, serviceType string, skipCount *int32, takeCount *int32) (result ServicesIterator, err error) {
1944	if tracing.IsEnabled() {
1945		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListPremium")
1946		defer func() {
1947			sc := -1
1948			if result.Response().Response.Response != nil {
1949				sc = result.page.Response().Response.Response.StatusCode
1950			}
1951			tracing.EndSpan(ctx, sc, err)
1952		}()
1953	}
1954	result.page, err = client.ListPremium(ctx, filter, serviceType, skipCount, takeCount)
1955	return
1956}
1957
1958// ListUserBadPasswordReport gets the bad password login attempt report for an user
1959// Parameters:
1960// serviceName - the name of the service.
1961// dataSource - the source of data, if its test data or customer data.
1962func (client ServicesClient) ListUserBadPasswordReport(ctx context.Context, serviceName string, dataSource string) (result ErrorReportUsersEntries, err error) {
1963	if tracing.IsEnabled() {
1964		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListUserBadPasswordReport")
1965		defer func() {
1966			sc := -1
1967			if result.Response.Response != nil {
1968				sc = result.Response.Response.StatusCode
1969			}
1970			tracing.EndSpan(ctx, sc, err)
1971		}()
1972	}
1973	req, err := client.ListUserBadPasswordReportPreparer(ctx, serviceName, dataSource)
1974	if err != nil {
1975		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListUserBadPasswordReport", nil, "Failure preparing request")
1976		return
1977	}
1978
1979	resp, err := client.ListUserBadPasswordReportSender(req)
1980	if err != nil {
1981		result.Response = autorest.Response{Response: resp}
1982		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListUserBadPasswordReport", resp, "Failure sending request")
1983		return
1984	}
1985
1986	result, err = client.ListUserBadPasswordReportResponder(resp)
1987	if err != nil {
1988		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "ListUserBadPasswordReport", resp, "Failure responding to request")
1989	}
1990
1991	return
1992}
1993
1994// ListUserBadPasswordReportPreparer prepares the ListUserBadPasswordReport request.
1995func (client ServicesClient) ListUserBadPasswordReportPreparer(ctx context.Context, serviceName string, dataSource string) (*http.Request, error) {
1996	pathParameters := map[string]interface{}{
1997		"serviceName": autorest.Encode("path", serviceName),
1998	}
1999
2000	const APIVersion = "2014-01-01"
2001	queryParameters := map[string]interface{}{
2002		"api-version": APIVersion,
2003	}
2004	if len(dataSource) > 0 {
2005		queryParameters["dataSource"] = autorest.Encode("query", dataSource)
2006	}
2007
2008	preparer := autorest.CreatePreparer(
2009		autorest.AsGet(),
2010		autorest.WithBaseURL(client.BaseURI),
2011		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/reports/badpassword/details/user", pathParameters),
2012		autorest.WithQueryParameters(queryParameters))
2013	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2014}
2015
2016// ListUserBadPasswordReportSender sends the ListUserBadPasswordReport request. The method will close the
2017// http.Response Body if it receives an error.
2018func (client ServicesClient) ListUserBadPasswordReportSender(req *http.Request) (*http.Response, error) {
2019	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2020	return autorest.SendWithSender(client, req, sd...)
2021}
2022
2023// ListUserBadPasswordReportResponder handles the response to the ListUserBadPasswordReport request. The method always
2024// closes the http.Response Body.
2025func (client ServicesClient) ListUserBadPasswordReportResponder(resp *http.Response) (result ErrorReportUsersEntries, err error) {
2026	err = autorest.Respond(
2027		resp,
2028		client.ByInspecting(),
2029		azure.WithErrorUnlessStatusCode(http.StatusOK),
2030		autorest.ByUnmarshallingJSON(&result),
2031		autorest.ByClosing())
2032	result.Response = autorest.Response{Response: resp}
2033	return
2034}
2035
2036// Update updates the service properties of an onboarded service.
2037// Parameters:
2038// serviceName - the name of the service which needs to be deleted.
2039// service - the service object.
2040func (client ServicesClient) Update(ctx context.Context, serviceName string, service ServiceProperties) (result ServiceProperties, err error) {
2041	if tracing.IsEnabled() {
2042		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Update")
2043		defer func() {
2044			sc := -1
2045			if result.Response.Response != nil {
2046				sc = result.Response.Response.StatusCode
2047			}
2048			tracing.EndSpan(ctx, sc, err)
2049		}()
2050	}
2051	req, err := client.UpdatePreparer(ctx, serviceName, service)
2052	if err != nil {
2053		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "Update", nil, "Failure preparing request")
2054		return
2055	}
2056
2057	resp, err := client.UpdateSender(req)
2058	if err != nil {
2059		result.Response = autorest.Response{Response: resp}
2060		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "Update", resp, "Failure sending request")
2061		return
2062	}
2063
2064	result, err = client.UpdateResponder(resp)
2065	if err != nil {
2066		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "Update", resp, "Failure responding to request")
2067	}
2068
2069	return
2070}
2071
2072// UpdatePreparer prepares the Update request.
2073func (client ServicesClient) UpdatePreparer(ctx context.Context, serviceName string, service ServiceProperties) (*http.Request, error) {
2074	pathParameters := map[string]interface{}{
2075		"serviceName": autorest.Encode("path", serviceName),
2076	}
2077
2078	const APIVersion = "2014-01-01"
2079	queryParameters := map[string]interface{}{
2080		"api-version": APIVersion,
2081	}
2082
2083	preparer := autorest.CreatePreparer(
2084		autorest.AsContentType("application/json; charset=utf-8"),
2085		autorest.AsPatch(),
2086		autorest.WithBaseURL(client.BaseURI),
2087		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}", pathParameters),
2088		autorest.WithJSON(service),
2089		autorest.WithQueryParameters(queryParameters))
2090	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2091}
2092
2093// UpdateSender sends the Update request. The method will close the
2094// http.Response Body if it receives an error.
2095func (client ServicesClient) UpdateSender(req *http.Request) (*http.Response, error) {
2096	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2097	return autorest.SendWithSender(client, req, sd...)
2098}
2099
2100// UpdateResponder handles the response to the Update request. The method always
2101// closes the http.Response Body.
2102func (client ServicesClient) UpdateResponder(resp *http.Response) (result ServiceProperties, err error) {
2103	err = autorest.Respond(
2104		resp,
2105		client.ByInspecting(),
2106		azure.WithErrorUnlessStatusCode(http.StatusOK),
2107		autorest.ByUnmarshallingJSON(&result),
2108		autorest.ByClosing())
2109	result.Response = autorest.Response{Response: resp}
2110	return
2111}
2112
2113// UpdateMonitoringConfiguration updates the service level monitoring configuration.
2114// Parameters:
2115// serviceName - the name of the service.
2116// configurationSetting - the monitoring configuration to update
2117func (client ServicesClient) UpdateMonitoringConfiguration(ctx context.Context, serviceName string, configurationSetting Item) (result autorest.Response, err error) {
2118	if tracing.IsEnabled() {
2119		ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.UpdateMonitoringConfiguration")
2120		defer func() {
2121			sc := -1
2122			if result.Response != nil {
2123				sc = result.Response.StatusCode
2124			}
2125			tracing.EndSpan(ctx, sc, err)
2126		}()
2127	}
2128	req, err := client.UpdateMonitoringConfigurationPreparer(ctx, serviceName, configurationSetting)
2129	if err != nil {
2130		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "UpdateMonitoringConfiguration", nil, "Failure preparing request")
2131		return
2132	}
2133
2134	resp, err := client.UpdateMonitoringConfigurationSender(req)
2135	if err != nil {
2136		result.Response = resp
2137		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "UpdateMonitoringConfiguration", resp, "Failure sending request")
2138		return
2139	}
2140
2141	result, err = client.UpdateMonitoringConfigurationResponder(resp)
2142	if err != nil {
2143		err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServicesClient", "UpdateMonitoringConfiguration", resp, "Failure responding to request")
2144	}
2145
2146	return
2147}
2148
2149// UpdateMonitoringConfigurationPreparer prepares the UpdateMonitoringConfiguration request.
2150func (client ServicesClient) UpdateMonitoringConfigurationPreparer(ctx context.Context, serviceName string, configurationSetting Item) (*http.Request, error) {
2151	pathParameters := map[string]interface{}{
2152		"serviceName": autorest.Encode("path", serviceName),
2153	}
2154
2155	const APIVersion = "2014-01-01"
2156	queryParameters := map[string]interface{}{
2157		"api-version": APIVersion,
2158	}
2159
2160	preparer := autorest.CreatePreparer(
2161		autorest.AsContentType("application/json; charset=utf-8"),
2162		autorest.AsPatch(),
2163		autorest.WithBaseURL(client.BaseURI),
2164		autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/monitoringconfiguration", pathParameters),
2165		autorest.WithJSON(configurationSetting),
2166		autorest.WithQueryParameters(queryParameters))
2167	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2168}
2169
2170// UpdateMonitoringConfigurationSender sends the UpdateMonitoringConfiguration request. The method will close the
2171// http.Response Body if it receives an error.
2172func (client ServicesClient) UpdateMonitoringConfigurationSender(req *http.Request) (*http.Response, error) {
2173	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2174	return autorest.SendWithSender(client, req, sd...)
2175}
2176
2177// UpdateMonitoringConfigurationResponder handles the response to the UpdateMonitoringConfiguration request. The method always
2178// closes the http.Response Body.
2179func (client ServicesClient) UpdateMonitoringConfigurationResponder(resp *http.Response) (result autorest.Response, err error) {
2180	err = autorest.Respond(
2181		resp,
2182		client.ByInspecting(),
2183		azure.WithErrorUnlessStatusCode(http.StatusOK),
2184		autorest.ByClosing())
2185	result.Response = resp
2186	return
2187}
2188