1 package managedapplications
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/validation"
14 "github.com/Azure/go-autorest/tracing"
15 "net/http"
16 )
17
18
19 type ApplicationDefinitionsClient struct {
20 BaseClient
21 }
22
23
24 func NewApplicationDefinitionsClient(subscriptionID string) ApplicationDefinitionsClient {
25 return NewApplicationDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
26 }
27
28
29
30
31 func NewApplicationDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationDefinitionsClient {
32 return ApplicationDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)}
33 }
34
35
36
37
38
39
40 func (client ApplicationDefinitionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition) (result ApplicationDefinitionsCreateOrUpdateFuture, err error) {
41 if tracing.IsEnabled() {
42 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.CreateOrUpdate")
43 defer func() {
44 sc := -1
45 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
46 sc = result.FutureAPI.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: 90, Chain: nil},
54 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
55 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}},
56 {TargetValue: applicationDefinitionName,
57 Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil},
58 {Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
59 {TargetValue: parameters,
60 Constraints: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties", Name: validation.Null, Rule: true,
61 Chain: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties.Authorizations", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
62 return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "CreateOrUpdate", err.Error())
63 }
64
65 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationDefinitionName, parameters)
66 if err != nil {
67 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request")
68 return
69 }
70
71 result, err = client.CreateOrUpdateSender(req)
72 if err != nil {
73 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
74 return
75 }
76
77 return
78 }
79
80
81 func (client ApplicationDefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition) (*http.Request, error) {
82 pathParameters := map[string]interface{}{
83 "applicationDefinitionName": autorest.Encode("path", applicationDefinitionName),
84 "resourceGroupName": autorest.Encode("path", resourceGroupName),
85 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
86 }
87
88 const APIVersion = "2017-09-01"
89 queryParameters := map[string]interface{}{
90 "api-version": APIVersion,
91 }
92
93 preparer := autorest.CreatePreparer(
94 autorest.AsContentType("application/json; charset=utf-8"),
95 autorest.AsPut(),
96 autorest.WithBaseURL(client.BaseURI),
97 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters),
98 autorest.WithJSON(parameters),
99 autorest.WithQueryParameters(queryParameters))
100 return preparer.Prepare((&http.Request{}).WithContext(ctx))
101 }
102
103
104
105 func (client ApplicationDefinitionsClient) CreateOrUpdateSender(req *http.Request) (future ApplicationDefinitionsCreateOrUpdateFuture, err error) {
106 var resp *http.Response
107 future.FutureAPI = &azure.Future{}
108 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
109 if err != nil {
110 return
111 }
112 var azf azure.Future
113 azf, err = azure.NewFutureFromResponse(resp)
114 future.FutureAPI = &azf
115 future.Result = future.result
116 return
117 }
118
119
120
121 func (client ApplicationDefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationDefinition, err error) {
122 err = autorest.Respond(
123 resp,
124 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
125 autorest.ByUnmarshallingJSON(&result),
126 autorest.ByClosing())
127 result.Response = autorest.Response{Response: resp}
128 return
129 }
130
131
132
133
134
135
136
137 func (client ApplicationDefinitionsClient) CreateOrUpdateByID(ctx context.Context, applicationDefinitionID string, parameters ApplicationDefinition) (result ApplicationDefinitionsCreateOrUpdateByIDFuture, err error) {
138 if tracing.IsEnabled() {
139 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.CreateOrUpdateByID")
140 defer func() {
141 sc := -1
142 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
143 sc = result.FutureAPI.Response().StatusCode
144 }
145 tracing.EndSpan(ctx, sc, err)
146 }()
147 }
148 if err := validation.Validate([]validation.Validation{
149 {TargetValue: parameters,
150 Constraints: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties", Name: validation.Null, Rule: true,
151 Chain: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties.Authorizations", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
152 return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "CreateOrUpdateByID", err.Error())
153 }
154
155 req, err := client.CreateOrUpdateByIDPreparer(ctx, applicationDefinitionID, parameters)
156 if err != nil {
157 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdateByID", nil, "Failure preparing request")
158 return
159 }
160
161 result, err = client.CreateOrUpdateByIDSender(req)
162 if err != nil {
163 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdateByID", result.Response(), "Failure sending request")
164 return
165 }
166
167 return
168 }
169
170
171 func (client ApplicationDefinitionsClient) CreateOrUpdateByIDPreparer(ctx context.Context, applicationDefinitionID string, parameters ApplicationDefinition) (*http.Request, error) {
172 pathParameters := map[string]interface{}{
173 "applicationDefinitionId": applicationDefinitionID,
174 }
175
176 const APIVersion = "2017-09-01"
177 queryParameters := map[string]interface{}{
178 "api-version": APIVersion,
179 }
180
181 preparer := autorest.CreatePreparer(
182 autorest.AsContentType("application/json; charset=utf-8"),
183 autorest.AsPut(),
184 autorest.WithBaseURL(client.BaseURI),
185 autorest.WithPathParameters("/{applicationDefinitionId}", pathParameters),
186 autorest.WithJSON(parameters),
187 autorest.WithQueryParameters(queryParameters))
188 return preparer.Prepare((&http.Request{}).WithContext(ctx))
189 }
190
191
192
193 func (client ApplicationDefinitionsClient) CreateOrUpdateByIDSender(req *http.Request) (future ApplicationDefinitionsCreateOrUpdateByIDFuture, err error) {
194 var resp *http.Response
195 future.FutureAPI = &azure.Future{}
196 resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
197 if err != nil {
198 return
199 }
200 var azf azure.Future
201 azf, err = azure.NewFutureFromResponse(resp)
202 future.FutureAPI = &azf
203 future.Result = future.result
204 return
205 }
206
207
208
209 func (client ApplicationDefinitionsClient) CreateOrUpdateByIDResponder(resp *http.Response) (result ApplicationDefinition, err error) {
210 err = autorest.Respond(
211 resp,
212 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
213 autorest.ByUnmarshallingJSON(&result),
214 autorest.ByClosing())
215 result.Response = autorest.Response{Response: resp}
216 return
217 }
218
219
220
221
222
223 func (client ApplicationDefinitionsClient) Delete(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result ApplicationDefinitionsDeleteFuture, err error) {
224 if tracing.IsEnabled() {
225 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.Delete")
226 defer func() {
227 sc := -1
228 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
229 sc = result.FutureAPI.Response().StatusCode
230 }
231 tracing.EndSpan(ctx, sc, err)
232 }()
233 }
234 if err := validation.Validate([]validation.Validation{
235 {TargetValue: resourceGroupName,
236 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
237 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
238 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}},
239 {TargetValue: applicationDefinitionName,
240 Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil},
241 {Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
242 return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "Delete", err.Error())
243 }
244
245 req, err := client.DeletePreparer(ctx, resourceGroupName, applicationDefinitionName)
246 if err != nil {
247 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Delete", nil, "Failure preparing request")
248 return
249 }
250
251 result, err = client.DeleteSender(req)
252 if err != nil {
253 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Delete", result.Response(), "Failure sending request")
254 return
255 }
256
257 return
258 }
259
260
261 func (client ApplicationDefinitionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (*http.Request, error) {
262 pathParameters := map[string]interface{}{
263 "applicationDefinitionName": autorest.Encode("path", applicationDefinitionName),
264 "resourceGroupName": autorest.Encode("path", resourceGroupName),
265 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
266 }
267
268 const APIVersion = "2017-09-01"
269 queryParameters := map[string]interface{}{
270 "api-version": APIVersion,
271 }
272
273 preparer := autorest.CreatePreparer(
274 autorest.AsDelete(),
275 autorest.WithBaseURL(client.BaseURI),
276 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters),
277 autorest.WithQueryParameters(queryParameters))
278 return preparer.Prepare((&http.Request{}).WithContext(ctx))
279 }
280
281
282
283 func (client ApplicationDefinitionsClient) DeleteSender(req *http.Request) (future ApplicationDefinitionsDeleteFuture, err error) {
284 var resp *http.Response
285 future.FutureAPI = &azure.Future{}
286 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
287 if err != nil {
288 return
289 }
290 var azf azure.Future
291 azf, err = azure.NewFutureFromResponse(resp)
292 future.FutureAPI = &azf
293 future.Result = future.result
294 return
295 }
296
297
298
299 func (client ApplicationDefinitionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
300 err = autorest.Respond(
301 resp,
302 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
303 autorest.ByClosing())
304 result.Response = resp
305 return
306 }
307
308
309
310
311
312
313 func (client ApplicationDefinitionsClient) DeleteByID(ctx context.Context, applicationDefinitionID string) (result ApplicationDefinitionsDeleteByIDFuture, err error) {
314 if tracing.IsEnabled() {
315 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.DeleteByID")
316 defer func() {
317 sc := -1
318 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
319 sc = result.FutureAPI.Response().StatusCode
320 }
321 tracing.EndSpan(ctx, sc, err)
322 }()
323 }
324 req, err := client.DeleteByIDPreparer(ctx, applicationDefinitionID)
325 if err != nil {
326 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "DeleteByID", nil, "Failure preparing request")
327 return
328 }
329
330 result, err = client.DeleteByIDSender(req)
331 if err != nil {
332 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "DeleteByID", result.Response(), "Failure sending request")
333 return
334 }
335
336 return
337 }
338
339
340 func (client ApplicationDefinitionsClient) DeleteByIDPreparer(ctx context.Context, applicationDefinitionID string) (*http.Request, error) {
341 pathParameters := map[string]interface{}{
342 "applicationDefinitionId": applicationDefinitionID,
343 }
344
345 const APIVersion = "2017-09-01"
346 queryParameters := map[string]interface{}{
347 "api-version": APIVersion,
348 }
349
350 preparer := autorest.CreatePreparer(
351 autorest.AsDelete(),
352 autorest.WithBaseURL(client.BaseURI),
353 autorest.WithPathParameters("/{applicationDefinitionId}", pathParameters),
354 autorest.WithQueryParameters(queryParameters))
355 return preparer.Prepare((&http.Request{}).WithContext(ctx))
356 }
357
358
359
360 func (client ApplicationDefinitionsClient) DeleteByIDSender(req *http.Request) (future ApplicationDefinitionsDeleteByIDFuture, err error) {
361 var resp *http.Response
362 future.FutureAPI = &azure.Future{}
363 resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
364 if err != nil {
365 return
366 }
367 var azf azure.Future
368 azf, err = azure.NewFutureFromResponse(resp)
369 future.FutureAPI = &azf
370 future.Result = future.result
371 return
372 }
373
374
375
376 func (client ApplicationDefinitionsClient) DeleteByIDResponder(resp *http.Response) (result autorest.Response, err error) {
377 err = autorest.Respond(
378 resp,
379 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
380 autorest.ByClosing())
381 result.Response = resp
382 return
383 }
384
385
386
387
388
389 func (client ApplicationDefinitionsClient) Get(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result ApplicationDefinition, err error) {
390 if tracing.IsEnabled() {
391 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.Get")
392 defer func() {
393 sc := -1
394 if result.Response.Response != nil {
395 sc = result.Response.Response.StatusCode
396 }
397 tracing.EndSpan(ctx, sc, err)
398 }()
399 }
400 if err := validation.Validate([]validation.Validation{
401 {TargetValue: resourceGroupName,
402 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
403 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
404 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}},
405 {TargetValue: applicationDefinitionName,
406 Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil},
407 {Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
408 return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "Get", err.Error())
409 }
410
411 req, err := client.GetPreparer(ctx, resourceGroupName, applicationDefinitionName)
412 if err != nil {
413 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Get", nil, "Failure preparing request")
414 return
415 }
416
417 resp, err := client.GetSender(req)
418 if err != nil {
419 result.Response = autorest.Response{Response: resp}
420 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Get", resp, "Failure sending request")
421 return
422 }
423
424 result, err = client.GetResponder(resp)
425 if err != nil {
426 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Get", resp, "Failure responding to request")
427 return
428 }
429
430 return
431 }
432
433
434 func (client ApplicationDefinitionsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (*http.Request, error) {
435 pathParameters := map[string]interface{}{
436 "applicationDefinitionName": autorest.Encode("path", applicationDefinitionName),
437 "resourceGroupName": autorest.Encode("path", resourceGroupName),
438 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
439 }
440
441 const APIVersion = "2017-09-01"
442 queryParameters := map[string]interface{}{
443 "api-version": APIVersion,
444 }
445
446 preparer := autorest.CreatePreparer(
447 autorest.AsGet(),
448 autorest.WithBaseURL(client.BaseURI),
449 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters),
450 autorest.WithQueryParameters(queryParameters))
451 return preparer.Prepare((&http.Request{}).WithContext(ctx))
452 }
453
454
455
456 func (client ApplicationDefinitionsClient) GetSender(req *http.Request) (*http.Response, error) {
457 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
458 }
459
460
461
462 func (client ApplicationDefinitionsClient) GetResponder(resp *http.Response) (result ApplicationDefinition, err error) {
463 err = autorest.Respond(
464 resp,
465 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound),
466 autorest.ByUnmarshallingJSON(&result),
467 autorest.ByClosing())
468 result.Response = autorest.Response{Response: resp}
469 return
470 }
471
472
473
474
475
476
477 func (client ApplicationDefinitionsClient) GetByID(ctx context.Context, applicationDefinitionID string) (result ApplicationDefinition, err error) {
478 if tracing.IsEnabled() {
479 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.GetByID")
480 defer func() {
481 sc := -1
482 if result.Response.Response != nil {
483 sc = result.Response.Response.StatusCode
484 }
485 tracing.EndSpan(ctx, sc, err)
486 }()
487 }
488 req, err := client.GetByIDPreparer(ctx, applicationDefinitionID)
489 if err != nil {
490 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "GetByID", nil, "Failure preparing request")
491 return
492 }
493
494 resp, err := client.GetByIDSender(req)
495 if err != nil {
496 result.Response = autorest.Response{Response: resp}
497 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "GetByID", resp, "Failure sending request")
498 return
499 }
500
501 result, err = client.GetByIDResponder(resp)
502 if err != nil {
503 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "GetByID", resp, "Failure responding to request")
504 return
505 }
506
507 return
508 }
509
510
511 func (client ApplicationDefinitionsClient) GetByIDPreparer(ctx context.Context, applicationDefinitionID string) (*http.Request, error) {
512 pathParameters := map[string]interface{}{
513 "applicationDefinitionId": applicationDefinitionID,
514 }
515
516 const APIVersion = "2017-09-01"
517 queryParameters := map[string]interface{}{
518 "api-version": APIVersion,
519 }
520
521 preparer := autorest.CreatePreparer(
522 autorest.AsGet(),
523 autorest.WithBaseURL(client.BaseURI),
524 autorest.WithPathParameters("/{applicationDefinitionId}", pathParameters),
525 autorest.WithQueryParameters(queryParameters))
526 return preparer.Prepare((&http.Request{}).WithContext(ctx))
527 }
528
529
530
531 func (client ApplicationDefinitionsClient) GetByIDSender(req *http.Request) (*http.Response, error) {
532 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
533 }
534
535
536
537 func (client ApplicationDefinitionsClient) GetByIDResponder(resp *http.Response) (result ApplicationDefinition, err error) {
538 err = autorest.Respond(
539 resp,
540 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound),
541 autorest.ByUnmarshallingJSON(&result),
542 autorest.ByClosing())
543 result.Response = autorest.Response{Response: resp}
544 return
545 }
546
547
548
549
550 func (client ApplicationDefinitionsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ApplicationDefinitionListResultPage, err error) {
551 if tracing.IsEnabled() {
552 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.ListByResourceGroup")
553 defer func() {
554 sc := -1
555 if result.adlr.Response.Response != nil {
556 sc = result.adlr.Response.Response.StatusCode
557 }
558 tracing.EndSpan(ctx, sc, err)
559 }()
560 }
561 if err := validation.Validate([]validation.Validation{
562 {TargetValue: resourceGroupName,
563 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
564 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
565 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil {
566 return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "ListByResourceGroup", err.Error())
567 }
568
569 result.fn = client.listByResourceGroupNextResults
570 req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
571 if err != nil {
572 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "ListByResourceGroup", nil, "Failure preparing request")
573 return
574 }
575
576 resp, err := client.ListByResourceGroupSender(req)
577 if err != nil {
578 result.adlr.Response = autorest.Response{Response: resp}
579 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "ListByResourceGroup", resp, "Failure sending request")
580 return
581 }
582
583 result.adlr, err = client.ListByResourceGroupResponder(resp)
584 if err != nil {
585 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "ListByResourceGroup", resp, "Failure responding to request")
586 return
587 }
588 if result.adlr.hasNextLink() && result.adlr.IsEmpty() {
589 err = result.NextWithContext(ctx)
590 return
591 }
592
593 return
594 }
595
596
597 func (client ApplicationDefinitionsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
598 pathParameters := map[string]interface{}{
599 "resourceGroupName": autorest.Encode("path", resourceGroupName),
600 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
601 }
602
603 const APIVersion = "2017-09-01"
604 queryParameters := map[string]interface{}{
605 "api-version": APIVersion,
606 }
607
608 preparer := autorest.CreatePreparer(
609 autorest.AsGet(),
610 autorest.WithBaseURL(client.BaseURI),
611 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions", pathParameters),
612 autorest.WithQueryParameters(queryParameters))
613 return preparer.Prepare((&http.Request{}).WithContext(ctx))
614 }
615
616
617
618 func (client ApplicationDefinitionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
619 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
620 }
621
622
623
624 func (client ApplicationDefinitionsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationDefinitionListResult, err error) {
625 err = autorest.Respond(
626 resp,
627 azure.WithErrorUnlessStatusCode(http.StatusOK),
628 autorest.ByUnmarshallingJSON(&result),
629 autorest.ByClosing())
630 result.Response = autorest.Response{Response: resp}
631 return
632 }
633
634
635 func (client ApplicationDefinitionsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ApplicationDefinitionListResult) (result ApplicationDefinitionListResult, err error) {
636 req, err := lastResults.applicationDefinitionListResultPreparer(ctx)
637 if err != nil {
638 return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
639 }
640 if req == nil {
641 return
642 }
643 resp, err := client.ListByResourceGroupSender(req)
644 if err != nil {
645 result.Response = autorest.Response{Response: resp}
646 return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
647 }
648 result, err = client.ListByResourceGroupResponder(resp)
649 if err != nil {
650 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
651 }
652 return
653 }
654
655
656 func (client ApplicationDefinitionsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ApplicationDefinitionListResultIterator, err error) {
657 if tracing.IsEnabled() {
658 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.ListByResourceGroup")
659 defer func() {
660 sc := -1
661 if result.Response().Response.Response != nil {
662 sc = result.page.Response().Response.Response.StatusCode
663 }
664 tracing.EndSpan(ctx, sc, err)
665 }()
666 }
667 result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
668 return
669 }
670
View as plain text