1 package servicemap
2
3
4
5
6
7
8
9 import (
10 "context"
11 "github.com/Azure/go-autorest/autorest"
12 "github.com/Azure/go-autorest/autorest/azure"
13 "github.com/Azure/go-autorest/autorest/date"
14 "github.com/Azure/go-autorest/autorest/validation"
15 "github.com/Azure/go-autorest/tracing"
16 "net/http"
17 )
18
19
20 type MachineGroupsClient struct {
21 BaseClient
22 }
23
24
25 func NewMachineGroupsClient(subscriptionID string) MachineGroupsClient {
26 return NewMachineGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID)
27 }
28
29
30
31 func NewMachineGroupsClientWithBaseURI(baseURI string, subscriptionID string) MachineGroupsClient {
32 return MachineGroupsClient{NewWithBaseURI(baseURI, subscriptionID)}
33 }
34
35
36
37
38
39
40 func (client MachineGroupsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, machineGroup MachineGroup) (result MachineGroup, err error) {
41 if tracing.IsEnabled() {
42 ctx = tracing.StartSpan(ctx, fqdn+"/MachineGroupsClient.Create")
43 defer func() {
44 sc := -1
45 if result.Response.Response != nil {
46 sc = result.Response.Response.StatusCode
47 }
48 tracing.EndSpan(ctx, sc, err)
49 }()
50 }
51 if err := validation.Validate([]validation.Validation{
52 {TargetValue: resourceGroupName,
53 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
54 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
55 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
56 {TargetValue: workspaceName,
57 Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
58 {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
59 {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
60 {TargetValue: machineGroup,
61 Constraints: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties", Name: validation.Null, Rule: false,
62 Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.Null, Rule: true,
63 Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MaxLength, Rule: 256, Chain: nil},
64 {Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil},
65 }},
66 }}}}}); err != nil {
67 return result, validation.NewError("servicemap.MachineGroupsClient", "Create", err.Error())
68 }
69
70 req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, machineGroup)
71 if err != nil {
72 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Create", nil, "Failure preparing request")
73 return
74 }
75
76 resp, err := client.CreateSender(req)
77 if err != nil {
78 result.Response = autorest.Response{Response: resp}
79 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Create", resp, "Failure sending request")
80 return
81 }
82
83 result, err = client.CreateResponder(resp)
84 if err != nil {
85 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Create", resp, "Failure responding to request")
86 return
87 }
88
89 return
90 }
91
92
93 func (client MachineGroupsClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, machineGroup MachineGroup) (*http.Request, error) {
94 pathParameters := map[string]interface{}{
95 "resourceGroupName": autorest.Encode("path", resourceGroupName),
96 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
97 "workspaceName": autorest.Encode("path", workspaceName),
98 }
99
100 const APIVersion = "2015-11-01-preview"
101 queryParameters := map[string]interface{}{
102 "api-version": APIVersion,
103 }
104
105 preparer := autorest.CreatePreparer(
106 autorest.AsContentType("application/json; charset=utf-8"),
107 autorest.AsPost(),
108 autorest.WithBaseURL(client.BaseURI),
109 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups", pathParameters),
110 autorest.WithJSON(machineGroup),
111 autorest.WithQueryParameters(queryParameters))
112 return preparer.Prepare((&http.Request{}).WithContext(ctx))
113 }
114
115
116
117 func (client MachineGroupsClient) CreateSender(req *http.Request) (*http.Response, error) {
118 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
119 }
120
121
122
123 func (client MachineGroupsClient) CreateResponder(resp *http.Response) (result MachineGroup, err error) {
124 err = autorest.Respond(
125 resp,
126 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
127 autorest.ByUnmarshallingJSON(&result),
128 autorest.ByClosing())
129 result.Response = autorest.Response{Response: resp}
130 return
131 }
132
133
134
135
136
137
138 func (client MachineGroupsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, machineGroupName string) (result autorest.Response, err error) {
139 if tracing.IsEnabled() {
140 ctx = tracing.StartSpan(ctx, fqdn+"/MachineGroupsClient.Delete")
141 defer func() {
142 sc := -1
143 if result.Response != nil {
144 sc = result.Response.StatusCode
145 }
146 tracing.EndSpan(ctx, sc, err)
147 }()
148 }
149 if err := validation.Validate([]validation.Validation{
150 {TargetValue: resourceGroupName,
151 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
152 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
153 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
154 {TargetValue: workspaceName,
155 Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
156 {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
157 {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
158 {TargetValue: machineGroupName,
159 Constraints: []validation.Constraint{{Target: "machineGroupName", Name: validation.MaxLength, Rule: 36, Chain: nil},
160 {Target: "machineGroupName", Name: validation.MinLength, Rule: 36, Chain: nil}}}}); err != nil {
161 return result, validation.NewError("servicemap.MachineGroupsClient", "Delete", err.Error())
162 }
163
164 req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, machineGroupName)
165 if err != nil {
166 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Delete", nil, "Failure preparing request")
167 return
168 }
169
170 resp, err := client.DeleteSender(req)
171 if err != nil {
172 result.Response = resp
173 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Delete", resp, "Failure sending request")
174 return
175 }
176
177 result, err = client.DeleteResponder(resp)
178 if err != nil {
179 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Delete", resp, "Failure responding to request")
180 return
181 }
182
183 return
184 }
185
186
187 func (client MachineGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, machineGroupName string) (*http.Request, error) {
188 pathParameters := map[string]interface{}{
189 "machineGroupName": autorest.Encode("path", machineGroupName),
190 "resourceGroupName": autorest.Encode("path", resourceGroupName),
191 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
192 "workspaceName": autorest.Encode("path", workspaceName),
193 }
194
195 const APIVersion = "2015-11-01-preview"
196 queryParameters := map[string]interface{}{
197 "api-version": APIVersion,
198 }
199
200 preparer := autorest.CreatePreparer(
201 autorest.AsDelete(),
202 autorest.WithBaseURL(client.BaseURI),
203 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", pathParameters),
204 autorest.WithQueryParameters(queryParameters))
205 return preparer.Prepare((&http.Request{}).WithContext(ctx))
206 }
207
208
209
210 func (client MachineGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) {
211 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
212 }
213
214
215
216 func (client MachineGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
217 err = autorest.Respond(
218 resp,
219 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
220 autorest.ByClosing())
221 result.Response = resp
222 return
223 }
224
225
226
227
228
229
230
231
232
233
234 func (client MachineGroupsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, machineGroupName string, startTime *date.Time, endTime *date.Time) (result MachineGroup, err error) {
235 if tracing.IsEnabled() {
236 ctx = tracing.StartSpan(ctx, fqdn+"/MachineGroupsClient.Get")
237 defer func() {
238 sc := -1
239 if result.Response.Response != nil {
240 sc = result.Response.Response.StatusCode
241 }
242 tracing.EndSpan(ctx, sc, err)
243 }()
244 }
245 if err := validation.Validate([]validation.Validation{
246 {TargetValue: resourceGroupName,
247 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
248 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
249 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
250 {TargetValue: workspaceName,
251 Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
252 {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
253 {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
254 {TargetValue: machineGroupName,
255 Constraints: []validation.Constraint{{Target: "machineGroupName", Name: validation.MaxLength, Rule: 36, Chain: nil},
256 {Target: "machineGroupName", Name: validation.MinLength, Rule: 36, Chain: nil}}}}); err != nil {
257 return result, validation.NewError("servicemap.MachineGroupsClient", "Get", err.Error())
258 }
259
260 req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, machineGroupName, startTime, endTime)
261 if err != nil {
262 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Get", nil, "Failure preparing request")
263 return
264 }
265
266 resp, err := client.GetSender(req)
267 if err != nil {
268 result.Response = autorest.Response{Response: resp}
269 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Get", resp, "Failure sending request")
270 return
271 }
272
273 result, err = client.GetResponder(resp)
274 if err != nil {
275 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Get", resp, "Failure responding to request")
276 return
277 }
278
279 return
280 }
281
282
283 func (client MachineGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, machineGroupName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
284 pathParameters := map[string]interface{}{
285 "machineGroupName": autorest.Encode("path", machineGroupName),
286 "resourceGroupName": autorest.Encode("path", resourceGroupName),
287 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
288 "workspaceName": autorest.Encode("path", workspaceName),
289 }
290
291 const APIVersion = "2015-11-01-preview"
292 queryParameters := map[string]interface{}{
293 "api-version": APIVersion,
294 }
295 if startTime != nil {
296 queryParameters["startTime"] = autorest.Encode("query", *startTime)
297 }
298 if endTime != nil {
299 queryParameters["endTime"] = autorest.Encode("query", *endTime)
300 }
301
302 preparer := autorest.CreatePreparer(
303 autorest.AsGet(),
304 autorest.WithBaseURL(client.BaseURI),
305 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", pathParameters),
306 autorest.WithQueryParameters(queryParameters))
307 return preparer.Prepare((&http.Request{}).WithContext(ctx))
308 }
309
310
311
312 func (client MachineGroupsClient) GetSender(req *http.Request) (*http.Response, error) {
313 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
314 }
315
316
317
318 func (client MachineGroupsClient) GetResponder(resp *http.Response) (result MachineGroup, err error) {
319 err = autorest.Respond(
320 resp,
321 azure.WithErrorUnlessStatusCode(http.StatusOK),
322 autorest.ByUnmarshallingJSON(&result),
323 autorest.ByClosing())
324 result.Response = autorest.Response{Response: resp}
325 return
326 }
327
328
329
330
331
332
333
334
335
336 func (client MachineGroupsClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string, startTime *date.Time, endTime *date.Time) (result MachineGroupCollectionPage, err error) {
337 if tracing.IsEnabled() {
338 ctx = tracing.StartSpan(ctx, fqdn+"/MachineGroupsClient.ListByWorkspace")
339 defer func() {
340 sc := -1
341 if result.mgc.Response.Response != nil {
342 sc = result.mgc.Response.Response.StatusCode
343 }
344 tracing.EndSpan(ctx, sc, err)
345 }()
346 }
347 if err := validation.Validate([]validation.Validation{
348 {TargetValue: resourceGroupName,
349 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
350 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
351 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
352 {TargetValue: workspaceName,
353 Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
354 {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
355 {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}}); err != nil {
356 return result, validation.NewError("servicemap.MachineGroupsClient", "ListByWorkspace", err.Error())
357 }
358
359 result.fn = client.listByWorkspaceNextResults
360 req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName, startTime, endTime)
361 if err != nil {
362 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", nil, "Failure preparing request")
363 return
364 }
365
366 resp, err := client.ListByWorkspaceSender(req)
367 if err != nil {
368 result.mgc.Response = autorest.Response{Response: resp}
369 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure sending request")
370 return
371 }
372
373 result.mgc, err = client.ListByWorkspaceResponder(resp)
374 if err != nil {
375 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure responding to request")
376 return
377 }
378 if result.mgc.hasNextLink() && result.mgc.IsEmpty() {
379 err = result.NextWithContext(ctx)
380 return
381 }
382
383 return
384 }
385
386
387 func (client MachineGroupsClient) ListByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
388 pathParameters := map[string]interface{}{
389 "resourceGroupName": autorest.Encode("path", resourceGroupName),
390 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
391 "workspaceName": autorest.Encode("path", workspaceName),
392 }
393
394 const APIVersion = "2015-11-01-preview"
395 queryParameters := map[string]interface{}{
396 "api-version": APIVersion,
397 }
398 if startTime != nil {
399 queryParameters["startTime"] = autorest.Encode("query", *startTime)
400 }
401 if endTime != nil {
402 queryParameters["endTime"] = autorest.Encode("query", *endTime)
403 }
404
405 preparer := autorest.CreatePreparer(
406 autorest.AsGet(),
407 autorest.WithBaseURL(client.BaseURI),
408 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups", pathParameters),
409 autorest.WithQueryParameters(queryParameters))
410 return preparer.Prepare((&http.Request{}).WithContext(ctx))
411 }
412
413
414
415 func (client MachineGroupsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) {
416 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
417 }
418
419
420
421 func (client MachineGroupsClient) ListByWorkspaceResponder(resp *http.Response) (result MachineGroupCollection, err error) {
422 err = autorest.Respond(
423 resp,
424 azure.WithErrorUnlessStatusCode(http.StatusOK),
425 autorest.ByUnmarshallingJSON(&result),
426 autorest.ByClosing())
427 result.Response = autorest.Response{Response: resp}
428 return
429 }
430
431
432 func (client MachineGroupsClient) listByWorkspaceNextResults(ctx context.Context, lastResults MachineGroupCollection) (result MachineGroupCollection, err error) {
433 req, err := lastResults.machineGroupCollectionPreparer(ctx)
434 if err != nil {
435 return result, autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request")
436 }
437 if req == nil {
438 return
439 }
440 resp, err := client.ListByWorkspaceSender(req)
441 if err != nil {
442 result.Response = autorest.Response{Response: resp}
443 return result, autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "listByWorkspaceNextResults", resp, "Failure sending next results request")
444 }
445 result, err = client.ListByWorkspaceResponder(resp)
446 if err != nil {
447 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request")
448 }
449 return
450 }
451
452
453 func (client MachineGroupsClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string, startTime *date.Time, endTime *date.Time) (result MachineGroupCollectionIterator, err error) {
454 if tracing.IsEnabled() {
455 ctx = tracing.StartSpan(ctx, fqdn+"/MachineGroupsClient.ListByWorkspace")
456 defer func() {
457 sc := -1
458 if result.Response().Response.Response != nil {
459 sc = result.page.Response().Response.Response.StatusCode
460 }
461 tracing.EndSpan(ctx, sc, err)
462 }()
463 }
464 result.page, err = client.ListByWorkspace(ctx, resourceGroupName, workspaceName, startTime, endTime)
465 return
466 }
467
468
469
470
471
472
473
474 func (client MachineGroupsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, machineGroupName string, machineGroup MachineGroup) (result MachineGroup, err error) {
475 if tracing.IsEnabled() {
476 ctx = tracing.StartSpan(ctx, fqdn+"/MachineGroupsClient.Update")
477 defer func() {
478 sc := -1
479 if result.Response.Response != nil {
480 sc = result.Response.Response.StatusCode
481 }
482 tracing.EndSpan(ctx, sc, err)
483 }()
484 }
485 if err := validation.Validate([]validation.Validation{
486 {TargetValue: resourceGroupName,
487 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
488 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
489 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
490 {TargetValue: workspaceName,
491 Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
492 {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
493 {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
494 {TargetValue: machineGroupName,
495 Constraints: []validation.Constraint{{Target: "machineGroupName", Name: validation.MaxLength, Rule: 36, Chain: nil},
496 {Target: "machineGroupName", Name: validation.MinLength, Rule: 36, Chain: nil}}},
497 {TargetValue: machineGroup,
498 Constraints: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties", Name: validation.Null, Rule: false,
499 Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.Null, Rule: true,
500 Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MaxLength, Rule: 256, Chain: nil},
501 {Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil},
502 }},
503 }}}}}); err != nil {
504 return result, validation.NewError("servicemap.MachineGroupsClient", "Update", err.Error())
505 }
506
507 req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, machineGroupName, machineGroup)
508 if err != nil {
509 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Update", nil, "Failure preparing request")
510 return
511 }
512
513 resp, err := client.UpdateSender(req)
514 if err != nil {
515 result.Response = autorest.Response{Response: resp}
516 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Update", resp, "Failure sending request")
517 return
518 }
519
520 result, err = client.UpdateResponder(resp)
521 if err != nil {
522 err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Update", resp, "Failure responding to request")
523 return
524 }
525
526 return
527 }
528
529
530 func (client MachineGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, machineGroupName string, machineGroup MachineGroup) (*http.Request, error) {
531 pathParameters := map[string]interface{}{
532 "machineGroupName": autorest.Encode("path", machineGroupName),
533 "resourceGroupName": autorest.Encode("path", resourceGroupName),
534 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
535 "workspaceName": autorest.Encode("path", workspaceName),
536 }
537
538 const APIVersion = "2015-11-01-preview"
539 queryParameters := map[string]interface{}{
540 "api-version": APIVersion,
541 }
542
543 preparer := autorest.CreatePreparer(
544 autorest.AsContentType("application/json; charset=utf-8"),
545 autorest.AsPut(),
546 autorest.WithBaseURL(client.BaseURI),
547 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", pathParameters),
548 autorest.WithJSON(machineGroup),
549 autorest.WithQueryParameters(queryParameters))
550 return preparer.Prepare((&http.Request{}).WithContext(ctx))
551 }
552
553
554
555 func (client MachineGroupsClient) UpdateSender(req *http.Request) (*http.Response, error) {
556 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
557 }
558
559
560
561 func (client MachineGroupsClient) UpdateResponder(resp *http.Response) (result MachineGroup, err error) {
562 err = autorest.Respond(
563 resp,
564 azure.WithErrorUnlessStatusCode(http.StatusOK),
565 autorest.ByUnmarshallingJSON(&result),
566 autorest.ByClosing())
567 result.Response = autorest.Response{Response: resp}
568 return
569 }
570
View as plain text