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 ApplicationsClient struct {
20 BaseClient
21 }
22
23
24 func NewApplicationsClient(subscriptionID string) ApplicationsClient {
25 return NewApplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
26 }
27
28
29
30 func NewApplicationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationsClient {
31 return ApplicationsClient{NewWithBaseURI(baseURI, subscriptionID)}
32 }
33
34
35
36
37
38
39 func (client ApplicationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationName string, parameters Application) (result ApplicationsCreateOrUpdateFuture, err error) {
40 if tracing.IsEnabled() {
41 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.CreateOrUpdate")
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 if err := validation.Validate([]validation.Validation{
51 {TargetValue: resourceGroupName,
52 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
53 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
54 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
55 {TargetValue: applicationName,
56 Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil},
57 {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
58 {TargetValue: parameters,
59 Constraints: []validation.Constraint{{Target: "parameters.ApplicationProperties", Name: validation.Null, Rule: true,
60 Chain: []validation.Constraint{{Target: "parameters.ApplicationProperties.JitAccessPolicy", Name: validation.Null, Rule: false,
61 Chain: []validation.Constraint{{Target: "parameters.ApplicationProperties.JitAccessPolicy.JitAccessEnabled", Name: validation.Null, Rule: true, Chain: nil}}},
62 {Target: "parameters.ApplicationProperties.CustomerSupport", Name: validation.Null, Rule: false,
63 Chain: []validation.Constraint{{Target: "parameters.ApplicationProperties.CustomerSupport.Email", Name: validation.Null, Rule: true, Chain: nil},
64 {Target: "parameters.ApplicationProperties.CustomerSupport.Phone", Name: validation.Null, Rule: true, Chain: nil},
65 }},
66 }},
67 {Target: "parameters.Plan", Name: validation.Null, Rule: false,
68 Chain: []validation.Constraint{{Target: "parameters.Plan.Name", Name: validation.Null, Rule: true, Chain: nil},
69 {Target: "parameters.Plan.Publisher", Name: validation.Null, Rule: true, Chain: nil},
70 {Target: "parameters.Plan.Product", Name: validation.Null, Rule: true, Chain: nil},
71 {Target: "parameters.Plan.Version", Name: validation.Null, Rule: true, Chain: nil},
72 }},
73 {Target: "parameters.Kind", Name: validation.Null, Rule: true,
74 Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil {
75 return result, validation.NewError("managedapplications.ApplicationsClient", "CreateOrUpdate", err.Error())
76 }
77
78 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationName, parameters)
79 if err != nil {
80 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "CreateOrUpdate", nil, "Failure preparing request")
81 return
82 }
83
84 result, err = client.CreateOrUpdateSender(req)
85 if err != nil {
86 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
87 return
88 }
89
90 return
91 }
92
93
94 func (client ApplicationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationName string, parameters Application) (*http.Request, error) {
95 pathParameters := map[string]interface{}{
96 "applicationName": autorest.Encode("path", applicationName),
97 "resourceGroupName": autorest.Encode("path", resourceGroupName),
98 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
99 }
100
101 const APIVersion = "2018-03-01"
102 queryParameters := map[string]interface{}{
103 "api-version": APIVersion,
104 }
105
106 preparer := autorest.CreatePreparer(
107 autorest.AsContentType("application/json; charset=utf-8"),
108 autorest.AsPut(),
109 autorest.WithBaseURL(client.BaseURI),
110 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}", pathParameters),
111 autorest.WithJSON(parameters),
112 autorest.WithQueryParameters(queryParameters))
113 return preparer.Prepare((&http.Request{}).WithContext(ctx))
114 }
115
116
117
118 func (client ApplicationsClient) CreateOrUpdateSender(req *http.Request) (future ApplicationsCreateOrUpdateFuture, err error) {
119 var resp *http.Response
120 future.FutureAPI = &azure.Future{}
121 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
122 if err != nil {
123 return
124 }
125 var azf azure.Future
126 azf, err = azure.NewFutureFromResponse(resp)
127 future.FutureAPI = &azf
128 future.Result = future.result
129 return
130 }
131
132
133
134 func (client ApplicationsClient) CreateOrUpdateResponder(resp *http.Response) (result Application, err error) {
135 err = autorest.Respond(
136 resp,
137 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
138 autorest.ByUnmarshallingJSON(&result),
139 autorest.ByClosing())
140 result.Response = autorest.Response{Response: resp}
141 return
142 }
143
144
145
146
147
148
149
150 func (client ApplicationsClient) CreateOrUpdateByID(ctx context.Context, applicationID string, parameters Application) (result ApplicationsCreateOrUpdateByIDFuture, err error) {
151 if tracing.IsEnabled() {
152 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.CreateOrUpdateByID")
153 defer func() {
154 sc := -1
155 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
156 sc = result.FutureAPI.Response().StatusCode
157 }
158 tracing.EndSpan(ctx, sc, err)
159 }()
160 }
161 if err := validation.Validate([]validation.Validation{
162 {TargetValue: parameters,
163 Constraints: []validation.Constraint{{Target: "parameters.ApplicationProperties", Name: validation.Null, Rule: true,
164 Chain: []validation.Constraint{{Target: "parameters.ApplicationProperties.JitAccessPolicy", Name: validation.Null, Rule: false,
165 Chain: []validation.Constraint{{Target: "parameters.ApplicationProperties.JitAccessPolicy.JitAccessEnabled", Name: validation.Null, Rule: true, Chain: nil}}},
166 {Target: "parameters.ApplicationProperties.CustomerSupport", Name: validation.Null, Rule: false,
167 Chain: []validation.Constraint{{Target: "parameters.ApplicationProperties.CustomerSupport.Email", Name: validation.Null, Rule: true, Chain: nil},
168 {Target: "parameters.ApplicationProperties.CustomerSupport.Phone", Name: validation.Null, Rule: true, Chain: nil},
169 }},
170 }},
171 {Target: "parameters.Plan", Name: validation.Null, Rule: false,
172 Chain: []validation.Constraint{{Target: "parameters.Plan.Name", Name: validation.Null, Rule: true, Chain: nil},
173 {Target: "parameters.Plan.Publisher", Name: validation.Null, Rule: true, Chain: nil},
174 {Target: "parameters.Plan.Product", Name: validation.Null, Rule: true, Chain: nil},
175 {Target: "parameters.Plan.Version", Name: validation.Null, Rule: true, Chain: nil},
176 }},
177 {Target: "parameters.Kind", Name: validation.Null, Rule: true,
178 Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil {
179 return result, validation.NewError("managedapplications.ApplicationsClient", "CreateOrUpdateByID", err.Error())
180 }
181
182 req, err := client.CreateOrUpdateByIDPreparer(ctx, applicationID, parameters)
183 if err != nil {
184 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "CreateOrUpdateByID", nil, "Failure preparing request")
185 return
186 }
187
188 result, err = client.CreateOrUpdateByIDSender(req)
189 if err != nil {
190 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "CreateOrUpdateByID", result.Response(), "Failure sending request")
191 return
192 }
193
194 return
195 }
196
197
198 func (client ApplicationsClient) CreateOrUpdateByIDPreparer(ctx context.Context, applicationID string, parameters Application) (*http.Request, error) {
199 pathParameters := map[string]interface{}{
200 "applicationId": applicationID,
201 }
202
203 const APIVersion = "2018-03-01"
204 queryParameters := map[string]interface{}{
205 "api-version": APIVersion,
206 }
207
208 preparer := autorest.CreatePreparer(
209 autorest.AsContentType("application/json; charset=utf-8"),
210 autorest.AsPut(),
211 autorest.WithBaseURL(client.BaseURI),
212 autorest.WithPathParameters("/{applicationId}", pathParameters),
213 autorest.WithJSON(parameters),
214 autorest.WithQueryParameters(queryParameters))
215 return preparer.Prepare((&http.Request{}).WithContext(ctx))
216 }
217
218
219
220 func (client ApplicationsClient) CreateOrUpdateByIDSender(req *http.Request) (future ApplicationsCreateOrUpdateByIDFuture, err error) {
221 var resp *http.Response
222 future.FutureAPI = &azure.Future{}
223 resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
224 if err != nil {
225 return
226 }
227 var azf azure.Future
228 azf, err = azure.NewFutureFromResponse(resp)
229 future.FutureAPI = &azf
230 future.Result = future.result
231 return
232 }
233
234
235
236 func (client ApplicationsClient) CreateOrUpdateByIDResponder(resp *http.Response) (result Application, err error) {
237 err = autorest.Respond(
238 resp,
239 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
240 autorest.ByUnmarshallingJSON(&result),
241 autorest.ByClosing())
242 result.Response = autorest.Response{Response: resp}
243 return
244 }
245
246
247
248
249
250 func (client ApplicationsClient) Delete(ctx context.Context, resourceGroupName string, applicationName string) (result ApplicationsDeleteFuture, err error) {
251 if tracing.IsEnabled() {
252 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Delete")
253 defer func() {
254 sc := -1
255 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
256 sc = result.FutureAPI.Response().StatusCode
257 }
258 tracing.EndSpan(ctx, sc, err)
259 }()
260 }
261 if err := validation.Validate([]validation.Validation{
262 {TargetValue: resourceGroupName,
263 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
264 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
265 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
266 {TargetValue: applicationName,
267 Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil},
268 {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
269 return result, validation.NewError("managedapplications.ApplicationsClient", "Delete", err.Error())
270 }
271
272 req, err := client.DeletePreparer(ctx, resourceGroupName, applicationName)
273 if err != nil {
274 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Delete", nil, "Failure preparing request")
275 return
276 }
277
278 result, err = client.DeleteSender(req)
279 if err != nil {
280 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Delete", result.Response(), "Failure sending request")
281 return
282 }
283
284 return
285 }
286
287
288 func (client ApplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationName string) (*http.Request, error) {
289 pathParameters := map[string]interface{}{
290 "applicationName": autorest.Encode("path", applicationName),
291 "resourceGroupName": autorest.Encode("path", resourceGroupName),
292 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
293 }
294
295 const APIVersion = "2018-03-01"
296 queryParameters := map[string]interface{}{
297 "api-version": APIVersion,
298 }
299
300 preparer := autorest.CreatePreparer(
301 autorest.AsDelete(),
302 autorest.WithBaseURL(client.BaseURI),
303 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}", pathParameters),
304 autorest.WithQueryParameters(queryParameters))
305 return preparer.Prepare((&http.Request{}).WithContext(ctx))
306 }
307
308
309
310 func (client ApplicationsClient) DeleteSender(req *http.Request) (future ApplicationsDeleteFuture, err error) {
311 var resp *http.Response
312 future.FutureAPI = &azure.Future{}
313 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
314 if err != nil {
315 return
316 }
317 var azf azure.Future
318 azf, err = azure.NewFutureFromResponse(resp)
319 future.FutureAPI = &azf
320 future.Result = future.result
321 return
322 }
323
324
325
326 func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
327 err = autorest.Respond(
328 resp,
329 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
330 autorest.ByClosing())
331 result.Response = resp
332 return
333 }
334
335
336
337
338
339
340 func (client ApplicationsClient) DeleteByID(ctx context.Context, applicationID string) (result ApplicationsDeleteByIDFuture, err error) {
341 if tracing.IsEnabled() {
342 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.DeleteByID")
343 defer func() {
344 sc := -1
345 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
346 sc = result.FutureAPI.Response().StatusCode
347 }
348 tracing.EndSpan(ctx, sc, err)
349 }()
350 }
351 req, err := client.DeleteByIDPreparer(ctx, applicationID)
352 if err != nil {
353 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "DeleteByID", nil, "Failure preparing request")
354 return
355 }
356
357 result, err = client.DeleteByIDSender(req)
358 if err != nil {
359 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "DeleteByID", result.Response(), "Failure sending request")
360 return
361 }
362
363 return
364 }
365
366
367 func (client ApplicationsClient) DeleteByIDPreparer(ctx context.Context, applicationID string) (*http.Request, error) {
368 pathParameters := map[string]interface{}{
369 "applicationId": applicationID,
370 }
371
372 const APIVersion = "2018-03-01"
373 queryParameters := map[string]interface{}{
374 "api-version": APIVersion,
375 }
376
377 preparer := autorest.CreatePreparer(
378 autorest.AsDelete(),
379 autorest.WithBaseURL(client.BaseURI),
380 autorest.WithPathParameters("/{applicationId}", pathParameters),
381 autorest.WithQueryParameters(queryParameters))
382 return preparer.Prepare((&http.Request{}).WithContext(ctx))
383 }
384
385
386
387 func (client ApplicationsClient) DeleteByIDSender(req *http.Request) (future ApplicationsDeleteByIDFuture, err error) {
388 var resp *http.Response
389 future.FutureAPI = &azure.Future{}
390 resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
391 if err != nil {
392 return
393 }
394 var azf azure.Future
395 azf, err = azure.NewFutureFromResponse(resp)
396 future.FutureAPI = &azf
397 future.Result = future.result
398 return
399 }
400
401
402
403 func (client ApplicationsClient) DeleteByIDResponder(resp *http.Response) (result autorest.Response, err error) {
404 err = autorest.Respond(
405 resp,
406 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
407 autorest.ByClosing())
408 result.Response = resp
409 return
410 }
411
412
413
414
415
416 func (client ApplicationsClient) Get(ctx context.Context, resourceGroupName string, applicationName string) (result Application, err error) {
417 if tracing.IsEnabled() {
418 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Get")
419 defer func() {
420 sc := -1
421 if result.Response.Response != nil {
422 sc = result.Response.Response.StatusCode
423 }
424 tracing.EndSpan(ctx, sc, err)
425 }()
426 }
427 if err := validation.Validate([]validation.Validation{
428 {TargetValue: resourceGroupName,
429 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
430 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
431 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
432 {TargetValue: applicationName,
433 Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil},
434 {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
435 return result, validation.NewError("managedapplications.ApplicationsClient", "Get", err.Error())
436 }
437
438 req, err := client.GetPreparer(ctx, resourceGroupName, applicationName)
439 if err != nil {
440 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Get", nil, "Failure preparing request")
441 return
442 }
443
444 resp, err := client.GetSender(req)
445 if err != nil {
446 result.Response = autorest.Response{Response: resp}
447 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Get", resp, "Failure sending request")
448 return
449 }
450
451 result, err = client.GetResponder(resp)
452 if err != nil {
453 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Get", resp, "Failure responding to request")
454 return
455 }
456
457 return
458 }
459
460
461 func (client ApplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationName string) (*http.Request, error) {
462 pathParameters := map[string]interface{}{
463 "applicationName": autorest.Encode("path", applicationName),
464 "resourceGroupName": autorest.Encode("path", resourceGroupName),
465 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
466 }
467
468 const APIVersion = "2018-03-01"
469 queryParameters := map[string]interface{}{
470 "api-version": APIVersion,
471 }
472
473 preparer := autorest.CreatePreparer(
474 autorest.AsGet(),
475 autorest.WithBaseURL(client.BaseURI),
476 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}", pathParameters),
477 autorest.WithQueryParameters(queryParameters))
478 return preparer.Prepare((&http.Request{}).WithContext(ctx))
479 }
480
481
482
483 func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) {
484 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
485 }
486
487
488
489 func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) {
490 err = autorest.Respond(
491 resp,
492 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound),
493 autorest.ByUnmarshallingJSON(&result),
494 autorest.ByClosing())
495 result.Response = autorest.Response{Response: resp}
496 return
497 }
498
499
500
501
502
503
504 func (client ApplicationsClient) GetByID(ctx context.Context, applicationID string) (result Application, err error) {
505 if tracing.IsEnabled() {
506 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.GetByID")
507 defer func() {
508 sc := -1
509 if result.Response.Response != nil {
510 sc = result.Response.Response.StatusCode
511 }
512 tracing.EndSpan(ctx, sc, err)
513 }()
514 }
515 req, err := client.GetByIDPreparer(ctx, applicationID)
516 if err != nil {
517 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "GetByID", nil, "Failure preparing request")
518 return
519 }
520
521 resp, err := client.GetByIDSender(req)
522 if err != nil {
523 result.Response = autorest.Response{Response: resp}
524 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "GetByID", resp, "Failure sending request")
525 return
526 }
527
528 result, err = client.GetByIDResponder(resp)
529 if err != nil {
530 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "GetByID", resp, "Failure responding to request")
531 return
532 }
533
534 return
535 }
536
537
538 func (client ApplicationsClient) GetByIDPreparer(ctx context.Context, applicationID string) (*http.Request, error) {
539 pathParameters := map[string]interface{}{
540 "applicationId": applicationID,
541 }
542
543 const APIVersion = "2018-03-01"
544 queryParameters := map[string]interface{}{
545 "api-version": APIVersion,
546 }
547
548 preparer := autorest.CreatePreparer(
549 autorest.AsGet(),
550 autorest.WithBaseURL(client.BaseURI),
551 autorest.WithPathParameters("/{applicationId}", pathParameters),
552 autorest.WithQueryParameters(queryParameters))
553 return preparer.Prepare((&http.Request{}).WithContext(ctx))
554 }
555
556
557
558 func (client ApplicationsClient) GetByIDSender(req *http.Request) (*http.Response, error) {
559 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
560 }
561
562
563
564 func (client ApplicationsClient) GetByIDResponder(resp *http.Response) (result Application, err error) {
565 err = autorest.Respond(
566 resp,
567 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound),
568 autorest.ByUnmarshallingJSON(&result),
569 autorest.ByClosing())
570 result.Response = autorest.Response{Response: resp}
571 return
572 }
573
574
575
576
577 func (client ApplicationsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ApplicationListResultPage, err error) {
578 if tracing.IsEnabled() {
579 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListByResourceGroup")
580 defer func() {
581 sc := -1
582 if result.alr.Response.Response != nil {
583 sc = result.alr.Response.Response.StatusCode
584 }
585 tracing.EndSpan(ctx, sc, err)
586 }()
587 }
588 if err := validation.Validate([]validation.Validation{
589 {TargetValue: resourceGroupName,
590 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
591 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
592 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
593 return result, validation.NewError("managedapplications.ApplicationsClient", "ListByResourceGroup", err.Error())
594 }
595
596 result.fn = client.listByResourceGroupNextResults
597 req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
598 if err != nil {
599 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListByResourceGroup", nil, "Failure preparing request")
600 return
601 }
602
603 resp, err := client.ListByResourceGroupSender(req)
604 if err != nil {
605 result.alr.Response = autorest.Response{Response: resp}
606 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListByResourceGroup", resp, "Failure sending request")
607 return
608 }
609
610 result.alr, err = client.ListByResourceGroupResponder(resp)
611 if err != nil {
612 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListByResourceGroup", resp, "Failure responding to request")
613 return
614 }
615 if result.alr.hasNextLink() && result.alr.IsEmpty() {
616 err = result.NextWithContext(ctx)
617 return
618 }
619
620 return
621 }
622
623
624 func (client ApplicationsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
625 pathParameters := map[string]interface{}{
626 "resourceGroupName": autorest.Encode("path", resourceGroupName),
627 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
628 }
629
630 const APIVersion = "2018-03-01"
631 queryParameters := map[string]interface{}{
632 "api-version": APIVersion,
633 }
634
635 preparer := autorest.CreatePreparer(
636 autorest.AsGet(),
637 autorest.WithBaseURL(client.BaseURI),
638 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications", pathParameters),
639 autorest.WithQueryParameters(queryParameters))
640 return preparer.Prepare((&http.Request{}).WithContext(ctx))
641 }
642
643
644
645 func (client ApplicationsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
646 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
647 }
648
649
650
651 func (client ApplicationsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationListResult, err error) {
652 err = autorest.Respond(
653 resp,
654 azure.WithErrorUnlessStatusCode(http.StatusOK),
655 autorest.ByUnmarshallingJSON(&result),
656 autorest.ByClosing())
657 result.Response = autorest.Response{Response: resp}
658 return
659 }
660
661
662 func (client ApplicationsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ApplicationListResult) (result ApplicationListResult, err error) {
663 req, err := lastResults.applicationListResultPreparer(ctx)
664 if err != nil {
665 return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
666 }
667 if req == nil {
668 return
669 }
670 resp, err := client.ListByResourceGroupSender(req)
671 if err != nil {
672 result.Response = autorest.Response{Response: resp}
673 return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
674 }
675 result, err = client.ListByResourceGroupResponder(resp)
676 if err != nil {
677 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
678 }
679 return
680 }
681
682
683 func (client ApplicationsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ApplicationListResultIterator, err error) {
684 if tracing.IsEnabled() {
685 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListByResourceGroup")
686 defer func() {
687 sc := -1
688 if result.Response().Response.Response != nil {
689 sc = result.page.Response().Response.Response.StatusCode
690 }
691 tracing.EndSpan(ctx, sc, err)
692 }()
693 }
694 result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
695 return
696 }
697
698
699 func (client ApplicationsClient) ListBySubscription(ctx context.Context) (result ApplicationListResultPage, err error) {
700 if tracing.IsEnabled() {
701 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListBySubscription")
702 defer func() {
703 sc := -1
704 if result.alr.Response.Response != nil {
705 sc = result.alr.Response.Response.StatusCode
706 }
707 tracing.EndSpan(ctx, sc, err)
708 }()
709 }
710 result.fn = client.listBySubscriptionNextResults
711 req, err := client.ListBySubscriptionPreparer(ctx)
712 if err != nil {
713 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListBySubscription", nil, "Failure preparing request")
714 return
715 }
716
717 resp, err := client.ListBySubscriptionSender(req)
718 if err != nil {
719 result.alr.Response = autorest.Response{Response: resp}
720 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListBySubscription", resp, "Failure sending request")
721 return
722 }
723
724 result.alr, err = client.ListBySubscriptionResponder(resp)
725 if err != nil {
726 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListBySubscription", resp, "Failure responding to request")
727 return
728 }
729 if result.alr.hasNextLink() && result.alr.IsEmpty() {
730 err = result.NextWithContext(ctx)
731 return
732 }
733
734 return
735 }
736
737
738 func (client ApplicationsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) {
739 pathParameters := map[string]interface{}{
740 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
741 }
742
743 const APIVersion = "2018-03-01"
744 queryParameters := map[string]interface{}{
745 "api-version": APIVersion,
746 }
747
748 preparer := autorest.CreatePreparer(
749 autorest.AsGet(),
750 autorest.WithBaseURL(client.BaseURI),
751 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applications", pathParameters),
752 autorest.WithQueryParameters(queryParameters))
753 return preparer.Prepare((&http.Request{}).WithContext(ctx))
754 }
755
756
757
758 func (client ApplicationsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) {
759 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
760 }
761
762
763
764 func (client ApplicationsClient) ListBySubscriptionResponder(resp *http.Response) (result ApplicationListResult, err error) {
765 err = autorest.Respond(
766 resp,
767 azure.WithErrorUnlessStatusCode(http.StatusOK),
768 autorest.ByUnmarshallingJSON(&result),
769 autorest.ByClosing())
770 result.Response = autorest.Response{Response: resp}
771 return
772 }
773
774
775 func (client ApplicationsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ApplicationListResult) (result ApplicationListResult, err error) {
776 req, err := lastResults.applicationListResultPreparer(ctx)
777 if err != nil {
778 return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request")
779 }
780 if req == nil {
781 return
782 }
783 resp, err := client.ListBySubscriptionSender(req)
784 if err != nil {
785 result.Response = autorest.Response{Response: resp}
786 return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request")
787 }
788 result, err = client.ListBySubscriptionResponder(resp)
789 if err != nil {
790 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request")
791 }
792 return
793 }
794
795
796 func (client ApplicationsClient) ListBySubscriptionComplete(ctx context.Context) (result ApplicationListResultIterator, err error) {
797 if tracing.IsEnabled() {
798 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListBySubscription")
799 defer func() {
800 sc := -1
801 if result.Response().Response.Response != nil {
802 sc = result.page.Response().Response.Response.StatusCode
803 }
804 tracing.EndSpan(ctx, sc, err)
805 }()
806 }
807 result.page, err = client.ListBySubscription(ctx)
808 return
809 }
810
811
812
813
814
815
816 func (client ApplicationsClient) ListTokens(ctx context.Context, resourceGroupName string, applicationName string, parameters ListTokenRequest) (result ManagedIdentityTokenResult, err error) {
817 if tracing.IsEnabled() {
818 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListTokens")
819 defer func() {
820 sc := -1
821 if result.Response.Response != nil {
822 sc = result.Response.Response.StatusCode
823 }
824 tracing.EndSpan(ctx, sc, err)
825 }()
826 }
827 if err := validation.Validate([]validation.Validation{
828 {TargetValue: resourceGroupName,
829 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
830 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
831 {TargetValue: applicationName,
832 Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil},
833 {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
834 return result, validation.NewError("managedapplications.ApplicationsClient", "ListTokens", err.Error())
835 }
836
837 req, err := client.ListTokensPreparer(ctx, resourceGroupName, applicationName, parameters)
838 if err != nil {
839 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListTokens", nil, "Failure preparing request")
840 return
841 }
842
843 resp, err := client.ListTokensSender(req)
844 if err != nil {
845 result.Response = autorest.Response{Response: resp}
846 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListTokens", resp, "Failure sending request")
847 return
848 }
849
850 result, err = client.ListTokensResponder(resp)
851 if err != nil {
852 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListTokens", resp, "Failure responding to request")
853 return
854 }
855
856 return
857 }
858
859
860 func (client ApplicationsClient) ListTokensPreparer(ctx context.Context, resourceGroupName string, applicationName string, parameters ListTokenRequest) (*http.Request, error) {
861 pathParameters := map[string]interface{}{
862 "applicationName": autorest.Encode("path", applicationName),
863 "resourceGroupName": autorest.Encode("path", resourceGroupName),
864 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
865 }
866
867 const APIVersion = "2018-03-01"
868 queryParameters := map[string]interface{}{
869 "api-version": APIVersion,
870 }
871
872 preparer := autorest.CreatePreparer(
873 autorest.AsContentType("application/json; charset=utf-8"),
874 autorest.AsPost(),
875 autorest.WithBaseURL(client.BaseURI),
876 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/listTokens", pathParameters),
877 autorest.WithJSON(parameters),
878 autorest.WithQueryParameters(queryParameters))
879 return preparer.Prepare((&http.Request{}).WithContext(ctx))
880 }
881
882
883
884 func (client ApplicationsClient) ListTokensSender(req *http.Request) (*http.Response, error) {
885 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
886 }
887
888
889
890 func (client ApplicationsClient) ListTokensResponder(resp *http.Response) (result ManagedIdentityTokenResult, err error) {
891 err = autorest.Respond(
892 resp,
893 azure.WithErrorUnlessStatusCode(http.StatusOK),
894 autorest.ByUnmarshallingJSON(&result),
895 autorest.ByClosing())
896 result.Response = autorest.Response{Response: resp}
897 return
898 }
899
900
901
902
903
904 func (client ApplicationsClient) RefreshPermissions(ctx context.Context, resourceGroupName string, applicationName string) (result ApplicationsRefreshPermissionsFuture, err error) {
905 if tracing.IsEnabled() {
906 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.RefreshPermissions")
907 defer func() {
908 sc := -1
909 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
910 sc = result.FutureAPI.Response().StatusCode
911 }
912 tracing.EndSpan(ctx, sc, err)
913 }()
914 }
915 if err := validation.Validate([]validation.Validation{
916 {TargetValue: resourceGroupName,
917 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
918 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
919 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
920 {TargetValue: applicationName,
921 Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil},
922 {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
923 return result, validation.NewError("managedapplications.ApplicationsClient", "RefreshPermissions", err.Error())
924 }
925
926 req, err := client.RefreshPermissionsPreparer(ctx, resourceGroupName, applicationName)
927 if err != nil {
928 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "RefreshPermissions", nil, "Failure preparing request")
929 return
930 }
931
932 result, err = client.RefreshPermissionsSender(req)
933 if err != nil {
934 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "RefreshPermissions", result.Response(), "Failure sending request")
935 return
936 }
937
938 return
939 }
940
941
942 func (client ApplicationsClient) RefreshPermissionsPreparer(ctx context.Context, resourceGroupName string, applicationName string) (*http.Request, error) {
943 pathParameters := map[string]interface{}{
944 "applicationName": autorest.Encode("path", applicationName),
945 "resourceGroupName": autorest.Encode("path", resourceGroupName),
946 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
947 }
948
949 const APIVersion = "2018-03-01"
950 queryParameters := map[string]interface{}{
951 "api-version": APIVersion,
952 }
953
954 preparer := autorest.CreatePreparer(
955 autorest.AsPost(),
956 autorest.WithBaseURL(client.BaseURI),
957 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/refreshPermissions", pathParameters),
958 autorest.WithQueryParameters(queryParameters))
959 return preparer.Prepare((&http.Request{}).WithContext(ctx))
960 }
961
962
963
964 func (client ApplicationsClient) RefreshPermissionsSender(req *http.Request) (future ApplicationsRefreshPermissionsFuture, err error) {
965 var resp *http.Response
966 future.FutureAPI = &azure.Future{}
967 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
968 if err != nil {
969 return
970 }
971 var azf azure.Future
972 azf, err = azure.NewFutureFromResponse(resp)
973 future.FutureAPI = &azf
974 future.Result = future.result
975 return
976 }
977
978
979
980 func (client ApplicationsClient) RefreshPermissionsResponder(resp *http.Response) (result autorest.Response, err error) {
981 err = autorest.Respond(
982 resp,
983 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
984 autorest.ByClosing())
985 result.Response = resp
986 return
987 }
988
989
990
991
992
993
994 func (client ApplicationsClient) Update(ctx context.Context, resourceGroupName string, applicationName string, parameters *ApplicationPatchable) (result ApplicationsUpdateFuture, err error) {
995 if tracing.IsEnabled() {
996 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Update")
997 defer func() {
998 sc := -1
999 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1000 sc = result.FutureAPI.Response().StatusCode
1001 }
1002 tracing.EndSpan(ctx, sc, err)
1003 }()
1004 }
1005 if err := validation.Validate([]validation.Validation{
1006 {TargetValue: resourceGroupName,
1007 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1008 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1009 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
1010 {TargetValue: applicationName,
1011 Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil},
1012 {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
1013 return result, validation.NewError("managedapplications.ApplicationsClient", "Update", err.Error())
1014 }
1015
1016 req, err := client.UpdatePreparer(ctx, resourceGroupName, applicationName, parameters)
1017 if err != nil {
1018 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Update", nil, "Failure preparing request")
1019 return
1020 }
1021
1022 result, err = client.UpdateSender(req)
1023 if err != nil {
1024 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "Update", result.Response(), "Failure sending request")
1025 return
1026 }
1027
1028 return
1029 }
1030
1031
1032 func (client ApplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, applicationName string, parameters *ApplicationPatchable) (*http.Request, error) {
1033 pathParameters := map[string]interface{}{
1034 "applicationName": autorest.Encode("path", applicationName),
1035 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1036 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1037 }
1038
1039 const APIVersion = "2018-03-01"
1040 queryParameters := map[string]interface{}{
1041 "api-version": APIVersion,
1042 }
1043
1044 preparer := autorest.CreatePreparer(
1045 autorest.AsContentType("application/json; charset=utf-8"),
1046 autorest.AsPatch(),
1047 autorest.WithBaseURL(client.BaseURI),
1048 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}", pathParameters),
1049 autorest.WithQueryParameters(queryParameters))
1050 if parameters != nil {
1051 preparer = autorest.DecoratePreparer(preparer,
1052 autorest.WithJSON(parameters))
1053 }
1054 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1055 }
1056
1057
1058
1059 func (client ApplicationsClient) UpdateSender(req *http.Request) (future ApplicationsUpdateFuture, err error) {
1060 var resp *http.Response
1061 future.FutureAPI = &azure.Future{}
1062 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1063 if err != nil {
1064 return
1065 }
1066 var azf azure.Future
1067 azf, err = azure.NewFutureFromResponse(resp)
1068 future.FutureAPI = &azf
1069 future.Result = future.result
1070 return
1071 }
1072
1073
1074
1075 func (client ApplicationsClient) UpdateResponder(resp *http.Response) (result ApplicationPatchable, err error) {
1076 err = autorest.Respond(
1077 resp,
1078 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1079 autorest.ByUnmarshallingJSON(&result),
1080 autorest.ByClosing())
1081 result.Response = autorest.Response{Response: resp}
1082 return
1083 }
1084
1085
1086
1087
1088
1089
1090 func (client ApplicationsClient) UpdateAccess(ctx context.Context, resourceGroupName string, applicationName string, parameters UpdateAccessDefinition) (result ApplicationsUpdateAccessFuture, err error) {
1091 if tracing.IsEnabled() {
1092 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.UpdateAccess")
1093 defer func() {
1094 sc := -1
1095 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1096 sc = result.FutureAPI.Response().StatusCode
1097 }
1098 tracing.EndSpan(ctx, sc, err)
1099 }()
1100 }
1101 if err := validation.Validate([]validation.Validation{
1102 {TargetValue: resourceGroupName,
1103 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1104 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1105 {TargetValue: applicationName,
1106 Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil},
1107 {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
1108 {TargetValue: parameters,
1109 Constraints: []validation.Constraint{{Target: "parameters.Metadata", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
1110 return result, validation.NewError("managedapplications.ApplicationsClient", "UpdateAccess", err.Error())
1111 }
1112
1113 req, err := client.UpdateAccessPreparer(ctx, resourceGroupName, applicationName, parameters)
1114 if err != nil {
1115 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "UpdateAccess", nil, "Failure preparing request")
1116 return
1117 }
1118
1119 result, err = client.UpdateAccessSender(req)
1120 if err != nil {
1121 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "UpdateAccess", result.Response(), "Failure sending request")
1122 return
1123 }
1124
1125 return
1126 }
1127
1128
1129 func (client ApplicationsClient) UpdateAccessPreparer(ctx context.Context, resourceGroupName string, applicationName string, parameters UpdateAccessDefinition) (*http.Request, error) {
1130 pathParameters := map[string]interface{}{
1131 "applicationName": autorest.Encode("path", applicationName),
1132 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1133 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1134 }
1135
1136 const APIVersion = "2018-03-01"
1137 queryParameters := map[string]interface{}{
1138 "api-version": APIVersion,
1139 }
1140
1141 preparer := autorest.CreatePreparer(
1142 autorest.AsContentType("application/json; charset=utf-8"),
1143 autorest.AsPost(),
1144 autorest.WithBaseURL(client.BaseURI),
1145 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/updateAccess", pathParameters),
1146 autorest.WithJSON(parameters),
1147 autorest.WithQueryParameters(queryParameters))
1148 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1149 }
1150
1151
1152
1153 func (client ApplicationsClient) UpdateAccessSender(req *http.Request) (future ApplicationsUpdateAccessFuture, err error) {
1154 var resp *http.Response
1155 future.FutureAPI = &azure.Future{}
1156 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1157 if err != nil {
1158 return
1159 }
1160 var azf azure.Future
1161 azf, err = azure.NewFutureFromResponse(resp)
1162 future.FutureAPI = &azf
1163 future.Result = future.result
1164 return
1165 }
1166
1167
1168
1169 func (client ApplicationsClient) UpdateAccessResponder(resp *http.Response) (result UpdateAccessDefinition, err error) {
1170 err = autorest.Respond(
1171 resp,
1172 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1173 autorest.ByUnmarshallingJSON(&result),
1174 autorest.ByClosing())
1175 result.Response = autorest.Response{Response: resp}
1176 return
1177 }
1178
1179
1180
1181
1182
1183
1184
1185 func (client ApplicationsClient) UpdateByID(ctx context.Context, applicationID string, parameters *ApplicationPatchable) (result ApplicationsUpdateByIDFuture, err error) {
1186 if tracing.IsEnabled() {
1187 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.UpdateByID")
1188 defer func() {
1189 sc := -1
1190 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1191 sc = result.FutureAPI.Response().StatusCode
1192 }
1193 tracing.EndSpan(ctx, sc, err)
1194 }()
1195 }
1196 req, err := client.UpdateByIDPreparer(ctx, applicationID, parameters)
1197 if err != nil {
1198 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "UpdateByID", nil, "Failure preparing request")
1199 return
1200 }
1201
1202 result, err = client.UpdateByIDSender(req)
1203 if err != nil {
1204 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "UpdateByID", result.Response(), "Failure sending request")
1205 return
1206 }
1207
1208 return
1209 }
1210
1211
1212 func (client ApplicationsClient) UpdateByIDPreparer(ctx context.Context, applicationID string, parameters *ApplicationPatchable) (*http.Request, error) {
1213 pathParameters := map[string]interface{}{
1214 "applicationId": applicationID,
1215 }
1216
1217 const APIVersion = "2018-03-01"
1218 queryParameters := map[string]interface{}{
1219 "api-version": APIVersion,
1220 }
1221
1222 preparer := autorest.CreatePreparer(
1223 autorest.AsContentType("application/json; charset=utf-8"),
1224 autorest.AsPatch(),
1225 autorest.WithBaseURL(client.BaseURI),
1226 autorest.WithPathParameters("/{applicationId}", pathParameters),
1227 autorest.WithQueryParameters(queryParameters))
1228 if parameters != nil {
1229 preparer = autorest.DecoratePreparer(preparer,
1230 autorest.WithJSON(parameters))
1231 }
1232 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1233 }
1234
1235
1236
1237 func (client ApplicationsClient) UpdateByIDSender(req *http.Request) (future ApplicationsUpdateByIDFuture, err error) {
1238 var resp *http.Response
1239 future.FutureAPI = &azure.Future{}
1240 resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1241 if err != nil {
1242 return
1243 }
1244 var azf azure.Future
1245 azf, err = azure.NewFutureFromResponse(resp)
1246 future.FutureAPI = &azf
1247 future.Result = future.result
1248 return
1249 }
1250
1251
1252
1253 func (client ApplicationsClient) UpdateByIDResponder(resp *http.Response) (result ApplicationPatchable, err error) {
1254 err = autorest.Respond(
1255 resp,
1256 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1257 autorest.ByUnmarshallingJSON(&result),
1258 autorest.ByClosing())
1259 result.Response = autorest.Response{Response: resp}
1260 return
1261 }
1262
View as plain text