1package hdinsight
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
10	"context"
11	"github.com/Azure/go-autorest/autorest"
12	"github.com/Azure/go-autorest/autorest/azure"
13	"github.com/Azure/go-autorest/tracing"
14	"net/http"
15)
16
17// ExtensionsClient is the hDInsight Management Client
18type ExtensionsClient struct {
19	BaseClient
20}
21
22// NewExtensionsClient creates an instance of the ExtensionsClient client.
23func NewExtensionsClient(subscriptionID string) ExtensionsClient {
24	return NewExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
25}
26
27// NewExtensionsClientWithBaseURI creates an instance of the ExtensionsClient client using a custom endpoint.  Use this
28// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
29func NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient {
30	return ExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)}
31}
32
33// Create creates an HDInsight cluster extension.
34// Parameters:
35// resourceGroupName - the name of the resource group.
36// clusterName - the name of the cluster.
37// extensionName - the name of the cluster extension.
38// parameters - the cluster extensions create request.
39func (client ExtensionsClient) Create(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, parameters Extension) (result ExtensionsCreateFuture, err error) {
40	if tracing.IsEnabled() {
41		ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Create")
42		defer func() {
43			sc := -1
44			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
45				sc = result.FutureAPI.Response().StatusCode
46			}
47			tracing.EndSpan(ctx, sc, err)
48		}()
49	}
50	req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, extensionName, parameters)
51	if err != nil {
52		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Create", nil, "Failure preparing request")
53		return
54	}
55
56	result, err = client.CreateSender(req)
57	if err != nil {
58		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Create", nil, "Failure sending request")
59		return
60	}
61
62	return
63}
64
65// CreatePreparer prepares the Create request.
66func (client ExtensionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, parameters Extension) (*http.Request, error) {
67	pathParameters := map[string]interface{}{
68		"clusterName":       autorest.Encode("path", clusterName),
69		"extensionName":     autorest.Encode("path", extensionName),
70		"resourceGroupName": autorest.Encode("path", resourceGroupName),
71		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
72	}
73
74	const APIVersion = "2018-06-01-preview"
75	queryParameters := map[string]interface{}{
76		"api-version": APIVersion,
77	}
78
79	preparer := autorest.CreatePreparer(
80		autorest.AsContentType("application/json; charset=utf-8"),
81		autorest.AsPut(),
82		autorest.WithBaseURL(client.BaseURI),
83		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}", pathParameters),
84		autorest.WithJSON(parameters),
85		autorest.WithQueryParameters(queryParameters))
86	return preparer.Prepare((&http.Request{}).WithContext(ctx))
87}
88
89// CreateSender sends the Create request. The method will close the
90// http.Response Body if it receives an error.
91func (client ExtensionsClient) CreateSender(req *http.Request) (future ExtensionsCreateFuture, err error) {
92	var resp *http.Response
93	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
94	if err != nil {
95		return
96	}
97	var azf azure.Future
98	azf, err = azure.NewFutureFromResponse(resp)
99	future.FutureAPI = &azf
100	future.Result = future.result
101	return
102}
103
104// CreateResponder handles the response to the Create request. The method always
105// closes the http.Response Body.
106func (client ExtensionsClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
107	err = autorest.Respond(
108		resp,
109		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
110		autorest.ByClosing())
111	result.Response = resp
112	return
113}
114
115// Delete deletes the specified extension for HDInsight cluster.
116// Parameters:
117// resourceGroupName - the name of the resource group.
118// clusterName - the name of the cluster.
119// extensionName - the name of the cluster extension.
120func (client ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (result ExtensionsDeleteFuture, err error) {
121	if tracing.IsEnabled() {
122		ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Delete")
123		defer func() {
124			sc := -1
125			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
126				sc = result.FutureAPI.Response().StatusCode
127			}
128			tracing.EndSpan(ctx, sc, err)
129		}()
130	}
131	req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, extensionName)
132	if err != nil {
133		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Delete", nil, "Failure preparing request")
134		return
135	}
136
137	result, err = client.DeleteSender(req)
138	if err != nil {
139		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Delete", nil, "Failure sending request")
140		return
141	}
142
143	return
144}
145
146// DeletePreparer prepares the Delete request.
147func (client ExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (*http.Request, error) {
148	pathParameters := map[string]interface{}{
149		"clusterName":       autorest.Encode("path", clusterName),
150		"extensionName":     autorest.Encode("path", extensionName),
151		"resourceGroupName": autorest.Encode("path", resourceGroupName),
152		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
153	}
154
155	const APIVersion = "2018-06-01-preview"
156	queryParameters := map[string]interface{}{
157		"api-version": APIVersion,
158	}
159
160	preparer := autorest.CreatePreparer(
161		autorest.AsDelete(),
162		autorest.WithBaseURL(client.BaseURI),
163		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}", pathParameters),
164		autorest.WithQueryParameters(queryParameters))
165	return preparer.Prepare((&http.Request{}).WithContext(ctx))
166}
167
168// DeleteSender sends the Delete request. The method will close the
169// http.Response Body if it receives an error.
170func (client ExtensionsClient) DeleteSender(req *http.Request) (future ExtensionsDeleteFuture, err error) {
171	var resp *http.Response
172	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
173	if err != nil {
174		return
175	}
176	var azf azure.Future
177	azf, err = azure.NewFutureFromResponse(resp)
178	future.FutureAPI = &azf
179	future.Result = future.result
180	return
181}
182
183// DeleteResponder handles the response to the Delete request. The method always
184// closes the http.Response Body.
185func (client ExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
186	err = autorest.Respond(
187		resp,
188		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
189		autorest.ByClosing())
190	result.Response = resp
191	return
192}
193
194// DisableAzureMonitor disables the Azure Monitor on the HDInsight cluster.
195// Parameters:
196// resourceGroupName - the name of the resource group.
197// clusterName - the name of the cluster.
198func (client ExtensionsClient) DisableAzureMonitor(ctx context.Context, resourceGroupName string, clusterName string) (result ExtensionsDisableAzureMonitorFuture, err error) {
199	if tracing.IsEnabled() {
200		ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.DisableAzureMonitor")
201		defer func() {
202			sc := -1
203			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
204				sc = result.FutureAPI.Response().StatusCode
205			}
206			tracing.EndSpan(ctx, sc, err)
207		}()
208	}
209	req, err := client.DisableAzureMonitorPreparer(ctx, resourceGroupName, clusterName)
210	if err != nil {
211		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "DisableAzureMonitor", nil, "Failure preparing request")
212		return
213	}
214
215	result, err = client.DisableAzureMonitorSender(req)
216	if err != nil {
217		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "DisableAzureMonitor", nil, "Failure sending request")
218		return
219	}
220
221	return
222}
223
224// DisableAzureMonitorPreparer prepares the DisableAzureMonitor request.
225func (client ExtensionsClient) DisableAzureMonitorPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) {
226	pathParameters := map[string]interface{}{
227		"clusterName":       autorest.Encode("path", clusterName),
228		"resourceGroupName": autorest.Encode("path", resourceGroupName),
229		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
230	}
231
232	const APIVersion = "2018-06-01-preview"
233	queryParameters := map[string]interface{}{
234		"api-version": APIVersion,
235	}
236
237	preparer := autorest.CreatePreparer(
238		autorest.AsDelete(),
239		autorest.WithBaseURL(client.BaseURI),
240		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor", pathParameters),
241		autorest.WithQueryParameters(queryParameters))
242	return preparer.Prepare((&http.Request{}).WithContext(ctx))
243}
244
245// DisableAzureMonitorSender sends the DisableAzureMonitor request. The method will close the
246// http.Response Body if it receives an error.
247func (client ExtensionsClient) DisableAzureMonitorSender(req *http.Request) (future ExtensionsDisableAzureMonitorFuture, err error) {
248	var resp *http.Response
249	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
250	if err != nil {
251		return
252	}
253	var azf azure.Future
254	azf, err = azure.NewFutureFromResponse(resp)
255	future.FutureAPI = &azf
256	future.Result = future.result
257	return
258}
259
260// DisableAzureMonitorResponder handles the response to the DisableAzureMonitor request. The method always
261// closes the http.Response Body.
262func (client ExtensionsClient) DisableAzureMonitorResponder(resp *http.Response) (result autorest.Response, err error) {
263	err = autorest.Respond(
264		resp,
265		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
266		autorest.ByClosing())
267	result.Response = resp
268	return
269}
270
271// DisableMonitoring disables the Operations Management Suite (OMS) on the HDInsight cluster.
272// Parameters:
273// resourceGroupName - the name of the resource group.
274// clusterName - the name of the cluster.
275func (client ExtensionsClient) DisableMonitoring(ctx context.Context, resourceGroupName string, clusterName string) (result ExtensionsDisableMonitoringFuture, err error) {
276	if tracing.IsEnabled() {
277		ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.DisableMonitoring")
278		defer func() {
279			sc := -1
280			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
281				sc = result.FutureAPI.Response().StatusCode
282			}
283			tracing.EndSpan(ctx, sc, err)
284		}()
285	}
286	req, err := client.DisableMonitoringPreparer(ctx, resourceGroupName, clusterName)
287	if err != nil {
288		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "DisableMonitoring", nil, "Failure preparing request")
289		return
290	}
291
292	result, err = client.DisableMonitoringSender(req)
293	if err != nil {
294		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "DisableMonitoring", nil, "Failure sending request")
295		return
296	}
297
298	return
299}
300
301// DisableMonitoringPreparer prepares the DisableMonitoring request.
302func (client ExtensionsClient) DisableMonitoringPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) {
303	pathParameters := map[string]interface{}{
304		"clusterName":       autorest.Encode("path", clusterName),
305		"resourceGroupName": autorest.Encode("path", resourceGroupName),
306		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
307	}
308
309	const APIVersion = "2018-06-01-preview"
310	queryParameters := map[string]interface{}{
311		"api-version": APIVersion,
312	}
313
314	preparer := autorest.CreatePreparer(
315		autorest.AsDelete(),
316		autorest.WithBaseURL(client.BaseURI),
317		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring", pathParameters),
318		autorest.WithQueryParameters(queryParameters))
319	return preparer.Prepare((&http.Request{}).WithContext(ctx))
320}
321
322// DisableMonitoringSender sends the DisableMonitoring request. The method will close the
323// http.Response Body if it receives an error.
324func (client ExtensionsClient) DisableMonitoringSender(req *http.Request) (future ExtensionsDisableMonitoringFuture, err error) {
325	var resp *http.Response
326	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
327	if err != nil {
328		return
329	}
330	var azf azure.Future
331	azf, err = azure.NewFutureFromResponse(resp)
332	future.FutureAPI = &azf
333	future.Result = future.result
334	return
335}
336
337// DisableMonitoringResponder handles the response to the DisableMonitoring request. The method always
338// closes the http.Response Body.
339func (client ExtensionsClient) DisableMonitoringResponder(resp *http.Response) (result autorest.Response, err error) {
340	err = autorest.Respond(
341		resp,
342		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
343		autorest.ByClosing())
344	result.Response = resp
345	return
346}
347
348// EnableAzureMonitor enables the Azure Monitor on the HDInsight cluster.
349// Parameters:
350// resourceGroupName - the name of the resource group.
351// clusterName - the name of the cluster.
352// parameters - the Log Analytics workspace parameters.
353func (client ExtensionsClient) EnableAzureMonitor(ctx context.Context, resourceGroupName string, clusterName string, parameters AzureMonitorRequest) (result ExtensionsEnableAzureMonitorFuture, err error) {
354	if tracing.IsEnabled() {
355		ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.EnableAzureMonitor")
356		defer func() {
357			sc := -1
358			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
359				sc = result.FutureAPI.Response().StatusCode
360			}
361			tracing.EndSpan(ctx, sc, err)
362		}()
363	}
364	req, err := client.EnableAzureMonitorPreparer(ctx, resourceGroupName, clusterName, parameters)
365	if err != nil {
366		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "EnableAzureMonitor", nil, "Failure preparing request")
367		return
368	}
369
370	result, err = client.EnableAzureMonitorSender(req)
371	if err != nil {
372		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "EnableAzureMonitor", nil, "Failure sending request")
373		return
374	}
375
376	return
377}
378
379// EnableAzureMonitorPreparer prepares the EnableAzureMonitor request.
380func (client ExtensionsClient) EnableAzureMonitorPreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters AzureMonitorRequest) (*http.Request, error) {
381	pathParameters := map[string]interface{}{
382		"clusterName":       autorest.Encode("path", clusterName),
383		"resourceGroupName": autorest.Encode("path", resourceGroupName),
384		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
385	}
386
387	const APIVersion = "2018-06-01-preview"
388	queryParameters := map[string]interface{}{
389		"api-version": APIVersion,
390	}
391
392	preparer := autorest.CreatePreparer(
393		autorest.AsContentType("application/json; charset=utf-8"),
394		autorest.AsPut(),
395		autorest.WithBaseURL(client.BaseURI),
396		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor", pathParameters),
397		autorest.WithJSON(parameters),
398		autorest.WithQueryParameters(queryParameters))
399	return preparer.Prepare((&http.Request{}).WithContext(ctx))
400}
401
402// EnableAzureMonitorSender sends the EnableAzureMonitor request. The method will close the
403// http.Response Body if it receives an error.
404func (client ExtensionsClient) EnableAzureMonitorSender(req *http.Request) (future ExtensionsEnableAzureMonitorFuture, err error) {
405	var resp *http.Response
406	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
407	if err != nil {
408		return
409	}
410	var azf azure.Future
411	azf, err = azure.NewFutureFromResponse(resp)
412	future.FutureAPI = &azf
413	future.Result = future.result
414	return
415}
416
417// EnableAzureMonitorResponder handles the response to the EnableAzureMonitor request. The method always
418// closes the http.Response Body.
419func (client ExtensionsClient) EnableAzureMonitorResponder(resp *http.Response) (result autorest.Response, err error) {
420	err = autorest.Respond(
421		resp,
422		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
423		autorest.ByClosing())
424	result.Response = resp
425	return
426}
427
428// EnableMonitoring enables the Operations Management Suite (OMS) on the HDInsight cluster.
429// Parameters:
430// resourceGroupName - the name of the resource group.
431// clusterName - the name of the cluster.
432// parameters - the Operations Management Suite (OMS) workspace parameters.
433func (client ExtensionsClient) EnableMonitoring(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterMonitoringRequest) (result ExtensionsEnableMonitoringFuture, err error) {
434	if tracing.IsEnabled() {
435		ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.EnableMonitoring")
436		defer func() {
437			sc := -1
438			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
439				sc = result.FutureAPI.Response().StatusCode
440			}
441			tracing.EndSpan(ctx, sc, err)
442		}()
443	}
444	req, err := client.EnableMonitoringPreparer(ctx, resourceGroupName, clusterName, parameters)
445	if err != nil {
446		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "EnableMonitoring", nil, "Failure preparing request")
447		return
448	}
449
450	result, err = client.EnableMonitoringSender(req)
451	if err != nil {
452		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "EnableMonitoring", nil, "Failure sending request")
453		return
454	}
455
456	return
457}
458
459// EnableMonitoringPreparer prepares the EnableMonitoring request.
460func (client ExtensionsClient) EnableMonitoringPreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterMonitoringRequest) (*http.Request, error) {
461	pathParameters := map[string]interface{}{
462		"clusterName":       autorest.Encode("path", clusterName),
463		"resourceGroupName": autorest.Encode("path", resourceGroupName),
464		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
465	}
466
467	const APIVersion = "2018-06-01-preview"
468	queryParameters := map[string]interface{}{
469		"api-version": APIVersion,
470	}
471
472	preparer := autorest.CreatePreparer(
473		autorest.AsContentType("application/json; charset=utf-8"),
474		autorest.AsPut(),
475		autorest.WithBaseURL(client.BaseURI),
476		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring", pathParameters),
477		autorest.WithJSON(parameters),
478		autorest.WithQueryParameters(queryParameters))
479	return preparer.Prepare((&http.Request{}).WithContext(ctx))
480}
481
482// EnableMonitoringSender sends the EnableMonitoring request. The method will close the
483// http.Response Body if it receives an error.
484func (client ExtensionsClient) EnableMonitoringSender(req *http.Request) (future ExtensionsEnableMonitoringFuture, err error) {
485	var resp *http.Response
486	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
487	if err != nil {
488		return
489	}
490	var azf azure.Future
491	azf, err = azure.NewFutureFromResponse(resp)
492	future.FutureAPI = &azf
493	future.Result = future.result
494	return
495}
496
497// EnableMonitoringResponder handles the response to the EnableMonitoring request. The method always
498// closes the http.Response Body.
499func (client ExtensionsClient) EnableMonitoringResponder(resp *http.Response) (result autorest.Response, err error) {
500	err = autorest.Respond(
501		resp,
502		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
503		autorest.ByClosing())
504	result.Response = resp
505	return
506}
507
508// Get gets the extension properties for the specified HDInsight cluster extension.
509// Parameters:
510// resourceGroupName - the name of the resource group.
511// clusterName - the name of the cluster.
512// extensionName - the name of the cluster extension.
513func (client ExtensionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (result ClusterMonitoringResponse, err error) {
514	if tracing.IsEnabled() {
515		ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Get")
516		defer func() {
517			sc := -1
518			if result.Response.Response != nil {
519				sc = result.Response.Response.StatusCode
520			}
521			tracing.EndSpan(ctx, sc, err)
522		}()
523	}
524	req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, extensionName)
525	if err != nil {
526		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Get", nil, "Failure preparing request")
527		return
528	}
529
530	resp, err := client.GetSender(req)
531	if err != nil {
532		result.Response = autorest.Response{Response: resp}
533		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Get", resp, "Failure sending request")
534		return
535	}
536
537	result, err = client.GetResponder(resp)
538	if err != nil {
539		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Get", resp, "Failure responding to request")
540		return
541	}
542
543	return
544}
545
546// GetPreparer prepares the Get request.
547func (client ExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (*http.Request, error) {
548	pathParameters := map[string]interface{}{
549		"clusterName":       autorest.Encode("path", clusterName),
550		"extensionName":     autorest.Encode("path", extensionName),
551		"resourceGroupName": autorest.Encode("path", resourceGroupName),
552		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
553	}
554
555	const APIVersion = "2018-06-01-preview"
556	queryParameters := map[string]interface{}{
557		"api-version": APIVersion,
558	}
559
560	preparer := autorest.CreatePreparer(
561		autorest.AsGet(),
562		autorest.WithBaseURL(client.BaseURI),
563		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}", pathParameters),
564		autorest.WithQueryParameters(queryParameters))
565	return preparer.Prepare((&http.Request{}).WithContext(ctx))
566}
567
568// GetSender sends the Get request. The method will close the
569// http.Response Body if it receives an error.
570func (client ExtensionsClient) GetSender(req *http.Request) (*http.Response, error) {
571	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
572}
573
574// GetResponder handles the response to the Get request. The method always
575// closes the http.Response Body.
576func (client ExtensionsClient) GetResponder(resp *http.Response) (result ClusterMonitoringResponse, err error) {
577	err = autorest.Respond(
578		resp,
579		azure.WithErrorUnlessStatusCode(http.StatusOK),
580		autorest.ByUnmarshallingJSON(&result),
581		autorest.ByClosing())
582	result.Response = autorest.Response{Response: resp}
583	return
584}
585
586// GetAzureAsyncOperationStatus gets the async operation status.
587// Parameters:
588// resourceGroupName - the name of the resource group.
589// clusterName - the name of the cluster.
590// extensionName - the name of the cluster extension.
591// operationID - the long running operation id.
592func (client ExtensionsClient) GetAzureAsyncOperationStatus(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, operationID string) (result AsyncOperationResult, err error) {
593	if tracing.IsEnabled() {
594		ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.GetAzureAsyncOperationStatus")
595		defer func() {
596			sc := -1
597			if result.Response.Response != nil {
598				sc = result.Response.Response.StatusCode
599			}
600			tracing.EndSpan(ctx, sc, err)
601		}()
602	}
603	req, err := client.GetAzureAsyncOperationStatusPreparer(ctx, resourceGroupName, clusterName, extensionName, operationID)
604	if err != nil {
605		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "GetAzureAsyncOperationStatus", nil, "Failure preparing request")
606		return
607	}
608
609	resp, err := client.GetAzureAsyncOperationStatusSender(req)
610	if err != nil {
611		result.Response = autorest.Response{Response: resp}
612		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "GetAzureAsyncOperationStatus", resp, "Failure sending request")
613		return
614	}
615
616	result, err = client.GetAzureAsyncOperationStatusResponder(resp)
617	if err != nil {
618		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "GetAzureAsyncOperationStatus", resp, "Failure responding to request")
619		return
620	}
621
622	return
623}
624
625// GetAzureAsyncOperationStatusPreparer prepares the GetAzureAsyncOperationStatus request.
626func (client ExtensionsClient) GetAzureAsyncOperationStatusPreparer(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, operationID string) (*http.Request, error) {
627	pathParameters := map[string]interface{}{
628		"clusterName":       autorest.Encode("path", clusterName),
629		"extensionName":     autorest.Encode("path", extensionName),
630		"operationId":       autorest.Encode("path", operationID),
631		"resourceGroupName": autorest.Encode("path", resourceGroupName),
632		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
633	}
634
635	const APIVersion = "2018-06-01-preview"
636	queryParameters := map[string]interface{}{
637		"api-version": APIVersion,
638	}
639
640	preparer := autorest.CreatePreparer(
641		autorest.AsGet(),
642		autorest.WithBaseURL(client.BaseURI),
643		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}/azureAsyncOperations/{operationId}", pathParameters),
644		autorest.WithQueryParameters(queryParameters))
645	return preparer.Prepare((&http.Request{}).WithContext(ctx))
646}
647
648// GetAzureAsyncOperationStatusSender sends the GetAzureAsyncOperationStatus request. The method will close the
649// http.Response Body if it receives an error.
650func (client ExtensionsClient) GetAzureAsyncOperationStatusSender(req *http.Request) (*http.Response, error) {
651	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
652}
653
654// GetAzureAsyncOperationStatusResponder handles the response to the GetAzureAsyncOperationStatus request. The method always
655// closes the http.Response Body.
656func (client ExtensionsClient) GetAzureAsyncOperationStatusResponder(resp *http.Response) (result AsyncOperationResult, err error) {
657	err = autorest.Respond(
658		resp,
659		azure.WithErrorUnlessStatusCode(http.StatusOK),
660		autorest.ByUnmarshallingJSON(&result),
661		autorest.ByClosing())
662	result.Response = autorest.Response{Response: resp}
663	return
664}
665
666// GetAzureMonitorStatus gets the status of Azure Monitor on the HDInsight cluster.
667// Parameters:
668// resourceGroupName - the name of the resource group.
669// clusterName - the name of the cluster.
670func (client ExtensionsClient) GetAzureMonitorStatus(ctx context.Context, resourceGroupName string, clusterName string) (result AzureMonitorResponse, err error) {
671	if tracing.IsEnabled() {
672		ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.GetAzureMonitorStatus")
673		defer func() {
674			sc := -1
675			if result.Response.Response != nil {
676				sc = result.Response.Response.StatusCode
677			}
678			tracing.EndSpan(ctx, sc, err)
679		}()
680	}
681	req, err := client.GetAzureMonitorStatusPreparer(ctx, resourceGroupName, clusterName)
682	if err != nil {
683		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "GetAzureMonitorStatus", nil, "Failure preparing request")
684		return
685	}
686
687	resp, err := client.GetAzureMonitorStatusSender(req)
688	if err != nil {
689		result.Response = autorest.Response{Response: resp}
690		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "GetAzureMonitorStatus", resp, "Failure sending request")
691		return
692	}
693
694	result, err = client.GetAzureMonitorStatusResponder(resp)
695	if err != nil {
696		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "GetAzureMonitorStatus", resp, "Failure responding to request")
697		return
698	}
699
700	return
701}
702
703// GetAzureMonitorStatusPreparer prepares the GetAzureMonitorStatus request.
704func (client ExtensionsClient) GetAzureMonitorStatusPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) {
705	pathParameters := map[string]interface{}{
706		"clusterName":       autorest.Encode("path", clusterName),
707		"resourceGroupName": autorest.Encode("path", resourceGroupName),
708		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
709	}
710
711	const APIVersion = "2018-06-01-preview"
712	queryParameters := map[string]interface{}{
713		"api-version": APIVersion,
714	}
715
716	preparer := autorest.CreatePreparer(
717		autorest.AsGet(),
718		autorest.WithBaseURL(client.BaseURI),
719		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor", pathParameters),
720		autorest.WithQueryParameters(queryParameters))
721	return preparer.Prepare((&http.Request{}).WithContext(ctx))
722}
723
724// GetAzureMonitorStatusSender sends the GetAzureMonitorStatus request. The method will close the
725// http.Response Body if it receives an error.
726func (client ExtensionsClient) GetAzureMonitorStatusSender(req *http.Request) (*http.Response, error) {
727	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
728}
729
730// GetAzureMonitorStatusResponder handles the response to the GetAzureMonitorStatus request. The method always
731// closes the http.Response Body.
732func (client ExtensionsClient) GetAzureMonitorStatusResponder(resp *http.Response) (result AzureMonitorResponse, err error) {
733	err = autorest.Respond(
734		resp,
735		azure.WithErrorUnlessStatusCode(http.StatusOK),
736		autorest.ByUnmarshallingJSON(&result),
737		autorest.ByClosing())
738	result.Response = autorest.Response{Response: resp}
739	return
740}
741
742// GetMonitoringStatus gets the status of Operations Management Suite (OMS) on the HDInsight cluster.
743// Parameters:
744// resourceGroupName - the name of the resource group.
745// clusterName - the name of the cluster.
746func (client ExtensionsClient) GetMonitoringStatus(ctx context.Context, resourceGroupName string, clusterName string) (result ClusterMonitoringResponse, err error) {
747	if tracing.IsEnabled() {
748		ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.GetMonitoringStatus")
749		defer func() {
750			sc := -1
751			if result.Response.Response != nil {
752				sc = result.Response.Response.StatusCode
753			}
754			tracing.EndSpan(ctx, sc, err)
755		}()
756	}
757	req, err := client.GetMonitoringStatusPreparer(ctx, resourceGroupName, clusterName)
758	if err != nil {
759		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "GetMonitoringStatus", nil, "Failure preparing request")
760		return
761	}
762
763	resp, err := client.GetMonitoringStatusSender(req)
764	if err != nil {
765		result.Response = autorest.Response{Response: resp}
766		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "GetMonitoringStatus", resp, "Failure sending request")
767		return
768	}
769
770	result, err = client.GetMonitoringStatusResponder(resp)
771	if err != nil {
772		err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "GetMonitoringStatus", resp, "Failure responding to request")
773		return
774	}
775
776	return
777}
778
779// GetMonitoringStatusPreparer prepares the GetMonitoringStatus request.
780func (client ExtensionsClient) GetMonitoringStatusPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) {
781	pathParameters := map[string]interface{}{
782		"clusterName":       autorest.Encode("path", clusterName),
783		"resourceGroupName": autorest.Encode("path", resourceGroupName),
784		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
785	}
786
787	const APIVersion = "2018-06-01-preview"
788	queryParameters := map[string]interface{}{
789		"api-version": APIVersion,
790	}
791
792	preparer := autorest.CreatePreparer(
793		autorest.AsGet(),
794		autorest.WithBaseURL(client.BaseURI),
795		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring", pathParameters),
796		autorest.WithQueryParameters(queryParameters))
797	return preparer.Prepare((&http.Request{}).WithContext(ctx))
798}
799
800// GetMonitoringStatusSender sends the GetMonitoringStatus request. The method will close the
801// http.Response Body if it receives an error.
802func (client ExtensionsClient) GetMonitoringStatusSender(req *http.Request) (*http.Response, error) {
803	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
804}
805
806// GetMonitoringStatusResponder handles the response to the GetMonitoringStatus request. The method always
807// closes the http.Response Body.
808func (client ExtensionsClient) GetMonitoringStatusResponder(resp *http.Response) (result ClusterMonitoringResponse, err error) {
809	err = autorest.Respond(
810		resp,
811		azure.WithErrorUnlessStatusCode(http.StatusOK),
812		autorest.ByUnmarshallingJSON(&result),
813		autorest.ByClosing())
814	result.Response = autorest.Response{Response: resp}
815	return
816}
817