1package graphrbac 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/autorest/to" 25 "github.com/Azure/go-autorest/autorest/validation" 26 "github.com/Azure/go-autorest/tracing" 27 "net/http" 28) 29 30// ApplicationsClient is the the Graph RBAC Management Client 31type ApplicationsClient struct { 32 BaseClient 33} 34 35// NewApplicationsClient creates an instance of the ApplicationsClient client. 36func NewApplicationsClient(tenantID string) ApplicationsClient { 37 return NewApplicationsClientWithBaseURI(DefaultBaseURI, tenantID) 38} 39 40// NewApplicationsClientWithBaseURI creates an instance of the ApplicationsClient client using a custom endpoint. Use 41// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 42func NewApplicationsClientWithBaseURI(baseURI string, tenantID string) ApplicationsClient { 43 return ApplicationsClient{NewWithBaseURI(baseURI, tenantID)} 44} 45 46// AddOwner add an owner to an application. 47// Parameters: 48// applicationObjectID - the object ID of the application to which to add the owner. 49// parameters - the URL of the owner object, such as 50// https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. 51func (client ApplicationsClient) AddOwner(ctx context.Context, applicationObjectID string, parameters AddOwnerParameters) (result autorest.Response, err error) { 52 if tracing.IsEnabled() { 53 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.AddOwner") 54 defer func() { 55 sc := -1 56 if result.Response != nil { 57 sc = result.Response.StatusCode 58 } 59 tracing.EndSpan(ctx, sc, err) 60 }() 61 } 62 if err := validation.Validate([]validation.Validation{ 63 {TargetValue: parameters, 64 Constraints: []validation.Constraint{{Target: "parameters.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 65 return result, validation.NewError("graphrbac.ApplicationsClient", "AddOwner", err.Error()) 66 } 67 68 req, err := client.AddOwnerPreparer(ctx, applicationObjectID, parameters) 69 if err != nil { 70 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "AddOwner", nil, "Failure preparing request") 71 return 72 } 73 74 resp, err := client.AddOwnerSender(req) 75 if err != nil { 76 result.Response = resp 77 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "AddOwner", resp, "Failure sending request") 78 return 79 } 80 81 result, err = client.AddOwnerResponder(resp) 82 if err != nil { 83 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "AddOwner", resp, "Failure responding to request") 84 } 85 86 return 87} 88 89// AddOwnerPreparer prepares the AddOwner request. 90func (client ApplicationsClient) AddOwnerPreparer(ctx context.Context, applicationObjectID string, parameters AddOwnerParameters) (*http.Request, error) { 91 pathParameters := map[string]interface{}{ 92 "applicationObjectId": autorest.Encode("path", applicationObjectID), 93 "tenantID": autorest.Encode("path", client.TenantID), 94 } 95 96 const APIVersion = "1.6" 97 queryParameters := map[string]interface{}{ 98 "api-version": APIVersion, 99 } 100 101 preparer := autorest.CreatePreparer( 102 autorest.AsContentType("application/json; charset=utf-8"), 103 autorest.AsPost(), 104 autorest.WithBaseURL(client.BaseURI), 105 autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/$links/owners", pathParameters), 106 autorest.WithJSON(parameters), 107 autorest.WithQueryParameters(queryParameters)) 108 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 109} 110 111// AddOwnerSender sends the AddOwner request. The method will close the 112// http.Response Body if it receives an error. 113func (client ApplicationsClient) AddOwnerSender(req *http.Request) (*http.Response, error) { 114 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 115} 116 117// AddOwnerResponder handles the response to the AddOwner request. The method always 118// closes the http.Response Body. 119func (client ApplicationsClient) AddOwnerResponder(resp *http.Response) (result autorest.Response, err error) { 120 err = autorest.Respond( 121 resp, 122 client.ByInspecting(), 123 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 124 autorest.ByClosing()) 125 result.Response = resp 126 return 127} 128 129// Create create a new application. 130// Parameters: 131// parameters - the parameters for creating an application. 132func (client ApplicationsClient) Create(ctx context.Context, parameters ApplicationCreateParameters) (result Application, err error) { 133 if tracing.IsEnabled() { 134 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Create") 135 defer func() { 136 sc := -1 137 if result.Response.Response != nil { 138 sc = result.Response.Response.StatusCode 139 } 140 tracing.EndSpan(ctx, sc, err) 141 }() 142 } 143 if err := validation.Validate([]validation.Validation{ 144 {TargetValue: parameters, 145 Constraints: []validation.Constraint{{Target: "parameters.DisplayName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 146 return result, validation.NewError("graphrbac.ApplicationsClient", "Create", err.Error()) 147 } 148 149 req, err := client.CreatePreparer(ctx, parameters) 150 if err != nil { 151 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", nil, "Failure preparing request") 152 return 153 } 154 155 resp, err := client.CreateSender(req) 156 if err != nil { 157 result.Response = autorest.Response{Response: resp} 158 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", resp, "Failure sending request") 159 return 160 } 161 162 result, err = client.CreateResponder(resp) 163 if err != nil { 164 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", resp, "Failure responding to request") 165 } 166 167 return 168} 169 170// CreatePreparer prepares the Create request. 171func (client ApplicationsClient) CreatePreparer(ctx context.Context, parameters ApplicationCreateParameters) (*http.Request, error) { 172 pathParameters := map[string]interface{}{ 173 "tenantID": autorest.Encode("path", client.TenantID), 174 } 175 176 const APIVersion = "1.6" 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.AsPost(), 184 autorest.WithBaseURL(client.BaseURI), 185 autorest.WithPathParameters("/{tenantID}/applications", pathParameters), 186 autorest.WithJSON(parameters), 187 autorest.WithQueryParameters(queryParameters)) 188 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 189} 190 191// CreateSender sends the Create request. The method will close the 192// http.Response Body if it receives an error. 193func (client ApplicationsClient) CreateSender(req *http.Request) (*http.Response, error) { 194 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 195} 196 197// CreateResponder handles the response to the Create request. The method always 198// closes the http.Response Body. 199func (client ApplicationsClient) CreateResponder(resp *http.Response) (result Application, err error) { 200 err = autorest.Respond( 201 resp, 202 client.ByInspecting(), 203 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 204 autorest.ByUnmarshallingJSON(&result), 205 autorest.ByClosing()) 206 result.Response = autorest.Response{Response: resp} 207 return 208} 209 210// Delete delete an application. 211// Parameters: 212// applicationObjectID - application object ID. 213func (client ApplicationsClient) Delete(ctx context.Context, applicationObjectID string) (result autorest.Response, err error) { 214 if tracing.IsEnabled() { 215 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Delete") 216 defer func() { 217 sc := -1 218 if result.Response != nil { 219 sc = result.Response.StatusCode 220 } 221 tracing.EndSpan(ctx, sc, err) 222 }() 223 } 224 req, err := client.DeletePreparer(ctx, applicationObjectID) 225 if err != nil { 226 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", nil, "Failure preparing request") 227 return 228 } 229 230 resp, err := client.DeleteSender(req) 231 if err != nil { 232 result.Response = resp 233 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", resp, "Failure sending request") 234 return 235 } 236 237 result, err = client.DeleteResponder(resp) 238 if err != nil { 239 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", resp, "Failure responding to request") 240 } 241 242 return 243} 244 245// DeletePreparer prepares the Delete request. 246func (client ApplicationsClient) DeletePreparer(ctx context.Context, applicationObjectID string) (*http.Request, error) { 247 pathParameters := map[string]interface{}{ 248 "applicationObjectId": autorest.Encode("path", applicationObjectID), 249 "tenantID": autorest.Encode("path", client.TenantID), 250 } 251 252 const APIVersion = "1.6" 253 queryParameters := map[string]interface{}{ 254 "api-version": APIVersion, 255 } 256 257 preparer := autorest.CreatePreparer( 258 autorest.AsDelete(), 259 autorest.WithBaseURL(client.BaseURI), 260 autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters), 261 autorest.WithQueryParameters(queryParameters)) 262 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 263} 264 265// DeleteSender sends the Delete request. The method will close the 266// http.Response Body if it receives an error. 267func (client ApplicationsClient) DeleteSender(req *http.Request) (*http.Response, error) { 268 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 269} 270 271// DeleteResponder handles the response to the Delete request. The method always 272// closes the http.Response Body. 273func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 274 err = autorest.Respond( 275 resp, 276 client.ByInspecting(), 277 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 278 autorest.ByClosing()) 279 result.Response = resp 280 return 281} 282 283// Get get an application by object ID. 284// Parameters: 285// applicationObjectID - application object ID. 286func (client ApplicationsClient) Get(ctx context.Context, applicationObjectID string) (result Application, err error) { 287 if tracing.IsEnabled() { 288 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Get") 289 defer func() { 290 sc := -1 291 if result.Response.Response != nil { 292 sc = result.Response.Response.StatusCode 293 } 294 tracing.EndSpan(ctx, sc, err) 295 }() 296 } 297 req, err := client.GetPreparer(ctx, applicationObjectID) 298 if err != nil { 299 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", nil, "Failure preparing request") 300 return 301 } 302 303 resp, err := client.GetSender(req) 304 if err != nil { 305 result.Response = autorest.Response{Response: resp} 306 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", resp, "Failure sending request") 307 return 308 } 309 310 result, err = client.GetResponder(resp) 311 if err != nil { 312 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", resp, "Failure responding to request") 313 } 314 315 return 316} 317 318// GetPreparer prepares the Get request. 319func (client ApplicationsClient) GetPreparer(ctx context.Context, applicationObjectID string) (*http.Request, error) { 320 pathParameters := map[string]interface{}{ 321 "applicationObjectId": autorest.Encode("path", applicationObjectID), 322 "tenantID": autorest.Encode("path", client.TenantID), 323 } 324 325 const APIVersion = "1.6" 326 queryParameters := map[string]interface{}{ 327 "api-version": APIVersion, 328 } 329 330 preparer := autorest.CreatePreparer( 331 autorest.AsGet(), 332 autorest.WithBaseURL(client.BaseURI), 333 autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters), 334 autorest.WithQueryParameters(queryParameters)) 335 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 336} 337 338// GetSender sends the Get request. The method will close the 339// http.Response Body if it receives an error. 340func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) { 341 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 342} 343 344// GetResponder handles the response to the Get request. The method always 345// closes the http.Response Body. 346func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) { 347 err = autorest.Respond( 348 resp, 349 client.ByInspecting(), 350 azure.WithErrorUnlessStatusCode(http.StatusOK), 351 autorest.ByUnmarshallingJSON(&result), 352 autorest.ByClosing()) 353 result.Response = autorest.Response{Response: resp} 354 return 355} 356 357// GetServicePrincipalsIDByAppID gets an object id for a given application id from the current tenant. 358// Parameters: 359// applicationID - the application ID. 360func (client ApplicationsClient) GetServicePrincipalsIDByAppID(ctx context.Context, applicationID string) (result ServicePrincipalObjectResult, err error) { 361 if tracing.IsEnabled() { 362 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.GetServicePrincipalsIDByAppID") 363 defer func() { 364 sc := -1 365 if result.Response.Response != nil { 366 sc = result.Response.Response.StatusCode 367 } 368 tracing.EndSpan(ctx, sc, err) 369 }() 370 } 371 req, err := client.GetServicePrincipalsIDByAppIDPreparer(ctx, applicationID) 372 if err != nil { 373 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "GetServicePrincipalsIDByAppID", nil, "Failure preparing request") 374 return 375 } 376 377 resp, err := client.GetServicePrincipalsIDByAppIDSender(req) 378 if err != nil { 379 result.Response = autorest.Response{Response: resp} 380 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "GetServicePrincipalsIDByAppID", resp, "Failure sending request") 381 return 382 } 383 384 result, err = client.GetServicePrincipalsIDByAppIDResponder(resp) 385 if err != nil { 386 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "GetServicePrincipalsIDByAppID", resp, "Failure responding to request") 387 } 388 389 return 390} 391 392// GetServicePrincipalsIDByAppIDPreparer prepares the GetServicePrincipalsIDByAppID request. 393func (client ApplicationsClient) GetServicePrincipalsIDByAppIDPreparer(ctx context.Context, applicationID string) (*http.Request, error) { 394 pathParameters := map[string]interface{}{ 395 "applicationID": autorest.Encode("path", applicationID), 396 "tenantID": autorest.Encode("path", client.TenantID), 397 } 398 399 const APIVersion = "1.6" 400 queryParameters := map[string]interface{}{ 401 "api-version": APIVersion, 402 } 403 404 preparer := autorest.CreatePreparer( 405 autorest.AsGet(), 406 autorest.WithBaseURL(client.BaseURI), 407 autorest.WithPathParameters("/{tenantID}/servicePrincipalsByAppId/{applicationID}/objectId", pathParameters), 408 autorest.WithQueryParameters(queryParameters)) 409 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 410} 411 412// GetServicePrincipalsIDByAppIDSender sends the GetServicePrincipalsIDByAppID request. The method will close the 413// http.Response Body if it receives an error. 414func (client ApplicationsClient) GetServicePrincipalsIDByAppIDSender(req *http.Request) (*http.Response, error) { 415 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 416} 417 418// GetServicePrincipalsIDByAppIDResponder handles the response to the GetServicePrincipalsIDByAppID request. The method always 419// closes the http.Response Body. 420func (client ApplicationsClient) GetServicePrincipalsIDByAppIDResponder(resp *http.Response) (result ServicePrincipalObjectResult, err error) { 421 err = autorest.Respond( 422 resp, 423 client.ByInspecting(), 424 azure.WithErrorUnlessStatusCode(http.StatusOK), 425 autorest.ByUnmarshallingJSON(&result), 426 autorest.ByClosing()) 427 result.Response = autorest.Response{Response: resp} 428 return 429} 430 431// List lists applications by filter parameters. 432// Parameters: 433// filter - the filters to apply to the operation. 434func (client ApplicationsClient) List(ctx context.Context, filter string) (result ApplicationListResultPage, err error) { 435 if tracing.IsEnabled() { 436 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.List") 437 defer func() { 438 sc := -1 439 if result.alr.Response.Response != nil { 440 sc = result.alr.Response.Response.StatusCode 441 } 442 tracing.EndSpan(ctx, sc, err) 443 }() 444 } 445 result.fn = func(ctx context.Context, lastResult ApplicationListResult) (ApplicationListResult, error) { 446 if lastResult.OdataNextLink == nil || len(to.String(lastResult.OdataNextLink)) < 1 { 447 return ApplicationListResult{}, nil 448 } 449 return client.ListNext(ctx, *lastResult.OdataNextLink) 450 } 451 req, err := client.ListPreparer(ctx, filter) 452 if err != nil { 453 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", nil, "Failure preparing request") 454 return 455 } 456 457 resp, err := client.ListSender(req) 458 if err != nil { 459 result.alr.Response = autorest.Response{Response: resp} 460 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", resp, "Failure sending request") 461 return 462 } 463 464 result.alr, err = client.ListResponder(resp) 465 if err != nil { 466 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", resp, "Failure responding to request") 467 } 468 469 return 470} 471 472// ListPreparer prepares the List request. 473func (client ApplicationsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { 474 pathParameters := map[string]interface{}{ 475 "tenantID": autorest.Encode("path", client.TenantID), 476 } 477 478 const APIVersion = "1.6" 479 queryParameters := map[string]interface{}{ 480 "api-version": APIVersion, 481 } 482 if len(filter) > 0 { 483 queryParameters["$filter"] = autorest.Encode("query", filter) 484 } 485 486 preparer := autorest.CreatePreparer( 487 autorest.AsGet(), 488 autorest.WithBaseURL(client.BaseURI), 489 autorest.WithPathParameters("/{tenantID}/applications", pathParameters), 490 autorest.WithQueryParameters(queryParameters)) 491 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 492} 493 494// ListSender sends the List request. The method will close the 495// http.Response Body if it receives an error. 496func (client ApplicationsClient) ListSender(req *http.Request) (*http.Response, error) { 497 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 498} 499 500// ListResponder handles the response to the List request. The method always 501// closes the http.Response Body. 502func (client ApplicationsClient) ListResponder(resp *http.Response) (result ApplicationListResult, err error) { 503 err = autorest.Respond( 504 resp, 505 client.ByInspecting(), 506 azure.WithErrorUnlessStatusCode(http.StatusOK), 507 autorest.ByUnmarshallingJSON(&result), 508 autorest.ByClosing()) 509 result.Response = autorest.Response{Response: resp} 510 return 511} 512 513// ListComplete enumerates all values, automatically crossing page boundaries as required. 514func (client ApplicationsClient) ListComplete(ctx context.Context, filter string) (result ApplicationListResultIterator, err error) { 515 if tracing.IsEnabled() { 516 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.List") 517 defer func() { 518 sc := -1 519 if result.Response().Response.Response != nil { 520 sc = result.page.Response().Response.Response.StatusCode 521 } 522 tracing.EndSpan(ctx, sc, err) 523 }() 524 } 525 result.page, err = client.List(ctx, filter) 526 return 527} 528 529// ListKeyCredentials get the keyCredentials associated with an application. 530// Parameters: 531// applicationObjectID - application object ID. 532func (client ApplicationsClient) ListKeyCredentials(ctx context.Context, applicationObjectID string) (result KeyCredentialListResult, err error) { 533 if tracing.IsEnabled() { 534 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListKeyCredentials") 535 defer func() { 536 sc := -1 537 if result.Response.Response != nil { 538 sc = result.Response.Response.StatusCode 539 } 540 tracing.EndSpan(ctx, sc, err) 541 }() 542 } 543 req, err := client.ListKeyCredentialsPreparer(ctx, applicationObjectID) 544 if err != nil { 545 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", nil, "Failure preparing request") 546 return 547 } 548 549 resp, err := client.ListKeyCredentialsSender(req) 550 if err != nil { 551 result.Response = autorest.Response{Response: resp} 552 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", resp, "Failure sending request") 553 return 554 } 555 556 result, err = client.ListKeyCredentialsResponder(resp) 557 if err != nil { 558 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", resp, "Failure responding to request") 559 } 560 561 return 562} 563 564// ListKeyCredentialsPreparer prepares the ListKeyCredentials request. 565func (client ApplicationsClient) ListKeyCredentialsPreparer(ctx context.Context, applicationObjectID string) (*http.Request, error) { 566 pathParameters := map[string]interface{}{ 567 "applicationObjectId": autorest.Encode("path", applicationObjectID), 568 "tenantID": autorest.Encode("path", client.TenantID), 569 } 570 571 const APIVersion = "1.6" 572 queryParameters := map[string]interface{}{ 573 "api-version": APIVersion, 574 } 575 576 preparer := autorest.CreatePreparer( 577 autorest.AsGet(), 578 autorest.WithBaseURL(client.BaseURI), 579 autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/keyCredentials", pathParameters), 580 autorest.WithQueryParameters(queryParameters)) 581 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 582} 583 584// ListKeyCredentialsSender sends the ListKeyCredentials request. The method will close the 585// http.Response Body if it receives an error. 586func (client ApplicationsClient) ListKeyCredentialsSender(req *http.Request) (*http.Response, error) { 587 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 588} 589 590// ListKeyCredentialsResponder handles the response to the ListKeyCredentials request. The method always 591// closes the http.Response Body. 592func (client ApplicationsClient) ListKeyCredentialsResponder(resp *http.Response) (result KeyCredentialListResult, err error) { 593 err = autorest.Respond( 594 resp, 595 client.ByInspecting(), 596 azure.WithErrorUnlessStatusCode(http.StatusOK), 597 autorest.ByUnmarshallingJSON(&result), 598 autorest.ByClosing()) 599 result.Response = autorest.Response{Response: resp} 600 return 601} 602 603// ListNext gets a list of applications from the current tenant. 604// Parameters: 605// nextLink - next link for the list operation. 606func (client ApplicationsClient) ListNext(ctx context.Context, nextLink string) (result ApplicationListResult, err error) { 607 if tracing.IsEnabled() { 608 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListNext") 609 defer func() { 610 sc := -1 611 if result.Response.Response != nil { 612 sc = result.Response.Response.StatusCode 613 } 614 tracing.EndSpan(ctx, sc, err) 615 }() 616 } 617 req, err := client.ListNextPreparer(ctx, nextLink) 618 if err != nil { 619 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", nil, "Failure preparing request") 620 return 621 } 622 623 resp, err := client.ListNextSender(req) 624 if err != nil { 625 result.Response = autorest.Response{Response: resp} 626 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", resp, "Failure sending request") 627 return 628 } 629 630 result, err = client.ListNextResponder(resp) 631 if err != nil { 632 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", resp, "Failure responding to request") 633 } 634 635 return 636} 637 638// ListNextPreparer prepares the ListNext request. 639func (client ApplicationsClient) ListNextPreparer(ctx context.Context, nextLink string) (*http.Request, error) { 640 pathParameters := map[string]interface{}{ 641 "nextLink": nextLink, 642 "tenantID": autorest.Encode("path", client.TenantID), 643 } 644 645 const APIVersion = "1.6" 646 queryParameters := map[string]interface{}{ 647 "api-version": APIVersion, 648 } 649 650 preparer := autorest.CreatePreparer( 651 autorest.AsGet(), 652 autorest.WithBaseURL(client.BaseURI), 653 autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), 654 autorest.WithQueryParameters(queryParameters)) 655 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 656} 657 658// ListNextSender sends the ListNext request. The method will close the 659// http.Response Body if it receives an error. 660func (client ApplicationsClient) ListNextSender(req *http.Request) (*http.Response, error) { 661 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 662} 663 664// ListNextResponder handles the response to the ListNext request. The method always 665// closes the http.Response Body. 666func (client ApplicationsClient) ListNextResponder(resp *http.Response) (result ApplicationListResult, err error) { 667 err = autorest.Respond( 668 resp, 669 client.ByInspecting(), 670 azure.WithErrorUnlessStatusCode(http.StatusOK), 671 autorest.ByUnmarshallingJSON(&result), 672 autorest.ByClosing()) 673 result.Response = autorest.Response{Response: resp} 674 return 675} 676 677// ListOwners the owners are a set of non-admin users who are allowed to modify this object. 678// Parameters: 679// applicationObjectID - the object ID of the application for which to get owners. 680func (client ApplicationsClient) ListOwners(ctx context.Context, applicationObjectID string) (result DirectoryObjectListResultPage, err error) { 681 if tracing.IsEnabled() { 682 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListOwners") 683 defer func() { 684 sc := -1 685 if result.dolr.Response.Response != nil { 686 sc = result.dolr.Response.Response.StatusCode 687 } 688 tracing.EndSpan(ctx, sc, err) 689 }() 690 } 691 result.fn = client.listOwnersNextResults 692 req, err := client.ListOwnersPreparer(ctx, applicationObjectID) 693 if err != nil { 694 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListOwners", nil, "Failure preparing request") 695 return 696 } 697 698 resp, err := client.ListOwnersSender(req) 699 if err != nil { 700 result.dolr.Response = autorest.Response{Response: resp} 701 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListOwners", resp, "Failure sending request") 702 return 703 } 704 705 result.dolr, err = client.ListOwnersResponder(resp) 706 if err != nil { 707 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListOwners", resp, "Failure responding to request") 708 } 709 710 return 711} 712 713// ListOwnersPreparer prepares the ListOwners request. 714func (client ApplicationsClient) ListOwnersPreparer(ctx context.Context, applicationObjectID string) (*http.Request, error) { 715 pathParameters := map[string]interface{}{ 716 "applicationObjectId": autorest.Encode("path", applicationObjectID), 717 "tenantID": autorest.Encode("path", client.TenantID), 718 } 719 720 const APIVersion = "1.6" 721 queryParameters := map[string]interface{}{ 722 "api-version": APIVersion, 723 } 724 725 preparer := autorest.CreatePreparer( 726 autorest.AsGet(), 727 autorest.WithBaseURL(client.BaseURI), 728 autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/owners", pathParameters), 729 autorest.WithQueryParameters(queryParameters)) 730 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 731} 732 733// ListOwnersSender sends the ListOwners request. The method will close the 734// http.Response Body if it receives an error. 735func (client ApplicationsClient) ListOwnersSender(req *http.Request) (*http.Response, error) { 736 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 737} 738 739// ListOwnersResponder handles the response to the ListOwners request. The method always 740// closes the http.Response Body. 741func (client ApplicationsClient) ListOwnersResponder(resp *http.Response) (result DirectoryObjectListResult, err error) { 742 err = autorest.Respond( 743 resp, 744 client.ByInspecting(), 745 azure.WithErrorUnlessStatusCode(http.StatusOK), 746 autorest.ByUnmarshallingJSON(&result), 747 autorest.ByClosing()) 748 result.Response = autorest.Response{Response: resp} 749 return 750} 751 752// listOwnersNextResults retrieves the next set of results, if any. 753func (client ApplicationsClient) listOwnersNextResults(ctx context.Context, lastResults DirectoryObjectListResult) (result DirectoryObjectListResult, err error) { 754 req, err := lastResults.directoryObjectListResultPreparer(ctx) 755 if err != nil { 756 return result, autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "listOwnersNextResults", nil, "Failure preparing next results request") 757 } 758 if req == nil { 759 return 760 } 761 resp, err := client.ListOwnersSender(req) 762 if err != nil { 763 result.Response = autorest.Response{Response: resp} 764 return result, autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "listOwnersNextResults", resp, "Failure sending next results request") 765 } 766 result, err = client.ListOwnersResponder(resp) 767 if err != nil { 768 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "listOwnersNextResults", resp, "Failure responding to next results request") 769 } 770 return 771} 772 773// ListOwnersComplete enumerates all values, automatically crossing page boundaries as required. 774func (client ApplicationsClient) ListOwnersComplete(ctx context.Context, applicationObjectID string) (result DirectoryObjectListResultIterator, err error) { 775 if tracing.IsEnabled() { 776 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListOwners") 777 defer func() { 778 sc := -1 779 if result.Response().Response.Response != nil { 780 sc = result.page.Response().Response.Response.StatusCode 781 } 782 tracing.EndSpan(ctx, sc, err) 783 }() 784 } 785 result.page, err = client.ListOwners(ctx, applicationObjectID) 786 return 787} 788 789// ListPasswordCredentials get the passwordCredentials associated with an application. 790// Parameters: 791// applicationObjectID - application object ID. 792func (client ApplicationsClient) ListPasswordCredentials(ctx context.Context, applicationObjectID string) (result PasswordCredentialListResult, err error) { 793 if tracing.IsEnabled() { 794 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListPasswordCredentials") 795 defer func() { 796 sc := -1 797 if result.Response.Response != nil { 798 sc = result.Response.Response.StatusCode 799 } 800 tracing.EndSpan(ctx, sc, err) 801 }() 802 } 803 req, err := client.ListPasswordCredentialsPreparer(ctx, applicationObjectID) 804 if err != nil { 805 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", nil, "Failure preparing request") 806 return 807 } 808 809 resp, err := client.ListPasswordCredentialsSender(req) 810 if err != nil { 811 result.Response = autorest.Response{Response: resp} 812 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", resp, "Failure sending request") 813 return 814 } 815 816 result, err = client.ListPasswordCredentialsResponder(resp) 817 if err != nil { 818 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", resp, "Failure responding to request") 819 } 820 821 return 822} 823 824// ListPasswordCredentialsPreparer prepares the ListPasswordCredentials request. 825func (client ApplicationsClient) ListPasswordCredentialsPreparer(ctx context.Context, applicationObjectID string) (*http.Request, error) { 826 pathParameters := map[string]interface{}{ 827 "applicationObjectId": autorest.Encode("path", applicationObjectID), 828 "tenantID": autorest.Encode("path", client.TenantID), 829 } 830 831 const APIVersion = "1.6" 832 queryParameters := map[string]interface{}{ 833 "api-version": APIVersion, 834 } 835 836 preparer := autorest.CreatePreparer( 837 autorest.AsGet(), 838 autorest.WithBaseURL(client.BaseURI), 839 autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/passwordCredentials", pathParameters), 840 autorest.WithQueryParameters(queryParameters)) 841 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 842} 843 844// ListPasswordCredentialsSender sends the ListPasswordCredentials request. The method will close the 845// http.Response Body if it receives an error. 846func (client ApplicationsClient) ListPasswordCredentialsSender(req *http.Request) (*http.Response, error) { 847 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 848} 849 850// ListPasswordCredentialsResponder handles the response to the ListPasswordCredentials request. The method always 851// closes the http.Response Body. 852func (client ApplicationsClient) ListPasswordCredentialsResponder(resp *http.Response) (result PasswordCredentialListResult, err error) { 853 err = autorest.Respond( 854 resp, 855 client.ByInspecting(), 856 azure.WithErrorUnlessStatusCode(http.StatusOK), 857 autorest.ByUnmarshallingJSON(&result), 858 autorest.ByClosing()) 859 result.Response = autorest.Response{Response: resp} 860 return 861} 862 863// Patch update an existing application. 864// Parameters: 865// applicationObjectID - application object ID. 866// parameters - parameters to update an existing application. 867func (client ApplicationsClient) Patch(ctx context.Context, applicationObjectID string, parameters ApplicationUpdateParameters) (result autorest.Response, err error) { 868 if tracing.IsEnabled() { 869 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Patch") 870 defer func() { 871 sc := -1 872 if result.Response != nil { 873 sc = result.Response.StatusCode 874 } 875 tracing.EndSpan(ctx, sc, err) 876 }() 877 } 878 req, err := client.PatchPreparer(ctx, applicationObjectID, parameters) 879 if err != nil { 880 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", nil, "Failure preparing request") 881 return 882 } 883 884 resp, err := client.PatchSender(req) 885 if err != nil { 886 result.Response = resp 887 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", resp, "Failure sending request") 888 return 889 } 890 891 result, err = client.PatchResponder(resp) 892 if err != nil { 893 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", resp, "Failure responding to request") 894 } 895 896 return 897} 898 899// PatchPreparer prepares the Patch request. 900func (client ApplicationsClient) PatchPreparer(ctx context.Context, applicationObjectID string, parameters ApplicationUpdateParameters) (*http.Request, error) { 901 pathParameters := map[string]interface{}{ 902 "applicationObjectId": autorest.Encode("path", applicationObjectID), 903 "tenantID": autorest.Encode("path", client.TenantID), 904 } 905 906 const APIVersion = "1.6" 907 queryParameters := map[string]interface{}{ 908 "api-version": APIVersion, 909 } 910 911 preparer := autorest.CreatePreparer( 912 autorest.AsContentType("application/json; charset=utf-8"), 913 autorest.AsPatch(), 914 autorest.WithBaseURL(client.BaseURI), 915 autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters), 916 autorest.WithJSON(parameters), 917 autorest.WithQueryParameters(queryParameters)) 918 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 919} 920 921// PatchSender sends the Patch request. The method will close the 922// http.Response Body if it receives an error. 923func (client ApplicationsClient) PatchSender(req *http.Request) (*http.Response, error) { 924 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 925} 926 927// PatchResponder handles the response to the Patch request. The method always 928// closes the http.Response Body. 929func (client ApplicationsClient) PatchResponder(resp *http.Response) (result autorest.Response, err error) { 930 err = autorest.Respond( 931 resp, 932 client.ByInspecting(), 933 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 934 autorest.ByClosing()) 935 result.Response = resp 936 return 937} 938 939// RemoveOwner remove a member from owners. 940// Parameters: 941// applicationObjectID - the object ID of the application from which to remove the owner. 942// ownerObjectID - owner object id 943func (client ApplicationsClient) RemoveOwner(ctx context.Context, applicationObjectID string, ownerObjectID string) (result autorest.Response, err error) { 944 if tracing.IsEnabled() { 945 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.RemoveOwner") 946 defer func() { 947 sc := -1 948 if result.Response != nil { 949 sc = result.Response.StatusCode 950 } 951 tracing.EndSpan(ctx, sc, err) 952 }() 953 } 954 req, err := client.RemoveOwnerPreparer(ctx, applicationObjectID, ownerObjectID) 955 if err != nil { 956 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "RemoveOwner", nil, "Failure preparing request") 957 return 958 } 959 960 resp, err := client.RemoveOwnerSender(req) 961 if err != nil { 962 result.Response = resp 963 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "RemoveOwner", resp, "Failure sending request") 964 return 965 } 966 967 result, err = client.RemoveOwnerResponder(resp) 968 if err != nil { 969 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "RemoveOwner", resp, "Failure responding to request") 970 } 971 972 return 973} 974 975// RemoveOwnerPreparer prepares the RemoveOwner request. 976func (client ApplicationsClient) RemoveOwnerPreparer(ctx context.Context, applicationObjectID string, ownerObjectID string) (*http.Request, error) { 977 pathParameters := map[string]interface{}{ 978 "applicationObjectId": autorest.Encode("path", applicationObjectID), 979 "ownerObjectId": autorest.Encode("path", ownerObjectID), 980 "tenantID": autorest.Encode("path", client.TenantID), 981 } 982 983 const APIVersion = "1.6" 984 queryParameters := map[string]interface{}{ 985 "api-version": APIVersion, 986 } 987 988 preparer := autorest.CreatePreparer( 989 autorest.AsDelete(), 990 autorest.WithBaseURL(client.BaseURI), 991 autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/$links/owners/{ownerObjectId}", pathParameters), 992 autorest.WithQueryParameters(queryParameters)) 993 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 994} 995 996// RemoveOwnerSender sends the RemoveOwner request. The method will close the 997// http.Response Body if it receives an error. 998func (client ApplicationsClient) RemoveOwnerSender(req *http.Request) (*http.Response, error) { 999 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1000} 1001 1002// RemoveOwnerResponder handles the response to the RemoveOwner request. The method always 1003// closes the http.Response Body. 1004func (client ApplicationsClient) RemoveOwnerResponder(resp *http.Response) (result autorest.Response, err error) { 1005 err = autorest.Respond( 1006 resp, 1007 client.ByInspecting(), 1008 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 1009 autorest.ByClosing()) 1010 result.Response = resp 1011 return 1012} 1013 1014// UpdateKeyCredentials update the keyCredentials associated with an application. 1015// Parameters: 1016// applicationObjectID - application object ID. 1017// parameters - parameters to update the keyCredentials of an existing application. 1018func (client ApplicationsClient) UpdateKeyCredentials(ctx context.Context, applicationObjectID string, parameters KeyCredentialsUpdateParameters) (result autorest.Response, err error) { 1019 if tracing.IsEnabled() { 1020 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.UpdateKeyCredentials") 1021 defer func() { 1022 sc := -1 1023 if result.Response != nil { 1024 sc = result.Response.StatusCode 1025 } 1026 tracing.EndSpan(ctx, sc, err) 1027 }() 1028 } 1029 req, err := client.UpdateKeyCredentialsPreparer(ctx, applicationObjectID, parameters) 1030 if err != nil { 1031 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", nil, "Failure preparing request") 1032 return 1033 } 1034 1035 resp, err := client.UpdateKeyCredentialsSender(req) 1036 if err != nil { 1037 result.Response = resp 1038 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", resp, "Failure sending request") 1039 return 1040 } 1041 1042 result, err = client.UpdateKeyCredentialsResponder(resp) 1043 if err != nil { 1044 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", resp, "Failure responding to request") 1045 } 1046 1047 return 1048} 1049 1050// UpdateKeyCredentialsPreparer prepares the UpdateKeyCredentials request. 1051func (client ApplicationsClient) UpdateKeyCredentialsPreparer(ctx context.Context, applicationObjectID string, parameters KeyCredentialsUpdateParameters) (*http.Request, error) { 1052 pathParameters := map[string]interface{}{ 1053 "applicationObjectId": autorest.Encode("path", applicationObjectID), 1054 "tenantID": autorest.Encode("path", client.TenantID), 1055 } 1056 1057 const APIVersion = "1.6" 1058 queryParameters := map[string]interface{}{ 1059 "api-version": APIVersion, 1060 } 1061 1062 preparer := autorest.CreatePreparer( 1063 autorest.AsContentType("application/json; charset=utf-8"), 1064 autorest.AsPatch(), 1065 autorest.WithBaseURL(client.BaseURI), 1066 autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/keyCredentials", pathParameters), 1067 autorest.WithJSON(parameters), 1068 autorest.WithQueryParameters(queryParameters)) 1069 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1070} 1071 1072// UpdateKeyCredentialsSender sends the UpdateKeyCredentials request. The method will close the 1073// http.Response Body if it receives an error. 1074func (client ApplicationsClient) UpdateKeyCredentialsSender(req *http.Request) (*http.Response, error) { 1075 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1076} 1077 1078// UpdateKeyCredentialsResponder handles the response to the UpdateKeyCredentials request. The method always 1079// closes the http.Response Body. 1080func (client ApplicationsClient) UpdateKeyCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { 1081 err = autorest.Respond( 1082 resp, 1083 client.ByInspecting(), 1084 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 1085 autorest.ByClosing()) 1086 result.Response = resp 1087 return 1088} 1089 1090// UpdatePasswordCredentials update passwordCredentials associated with an application. 1091// Parameters: 1092// applicationObjectID - application object ID. 1093// parameters - parameters to update passwordCredentials of an existing application. 1094func (client ApplicationsClient) UpdatePasswordCredentials(ctx context.Context, applicationObjectID string, parameters PasswordCredentialsUpdateParameters) (result autorest.Response, err error) { 1095 if tracing.IsEnabled() { 1096 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.UpdatePasswordCredentials") 1097 defer func() { 1098 sc := -1 1099 if result.Response != nil { 1100 sc = result.Response.StatusCode 1101 } 1102 tracing.EndSpan(ctx, sc, err) 1103 }() 1104 } 1105 req, err := client.UpdatePasswordCredentialsPreparer(ctx, applicationObjectID, parameters) 1106 if err != nil { 1107 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", nil, "Failure preparing request") 1108 return 1109 } 1110 1111 resp, err := client.UpdatePasswordCredentialsSender(req) 1112 if err != nil { 1113 result.Response = resp 1114 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", resp, "Failure sending request") 1115 return 1116 } 1117 1118 result, err = client.UpdatePasswordCredentialsResponder(resp) 1119 if err != nil { 1120 err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", resp, "Failure responding to request") 1121 } 1122 1123 return 1124} 1125 1126// UpdatePasswordCredentialsPreparer prepares the UpdatePasswordCredentials request. 1127func (client ApplicationsClient) UpdatePasswordCredentialsPreparer(ctx context.Context, applicationObjectID string, parameters PasswordCredentialsUpdateParameters) (*http.Request, error) { 1128 pathParameters := map[string]interface{}{ 1129 "applicationObjectId": autorest.Encode("path", applicationObjectID), 1130 "tenantID": autorest.Encode("path", client.TenantID), 1131 } 1132 1133 const APIVersion = "1.6" 1134 queryParameters := map[string]interface{}{ 1135 "api-version": APIVersion, 1136 } 1137 1138 preparer := autorest.CreatePreparer( 1139 autorest.AsContentType("application/json; charset=utf-8"), 1140 autorest.AsPatch(), 1141 autorest.WithBaseURL(client.BaseURI), 1142 autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/passwordCredentials", pathParameters), 1143 autorest.WithJSON(parameters), 1144 autorest.WithQueryParameters(queryParameters)) 1145 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1146} 1147 1148// UpdatePasswordCredentialsSender sends the UpdatePasswordCredentials request. The method will close the 1149// http.Response Body if it receives an error. 1150func (client ApplicationsClient) UpdatePasswordCredentialsSender(req *http.Request) (*http.Response, error) { 1151 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1152} 1153 1154// UpdatePasswordCredentialsResponder handles the response to the UpdatePasswordCredentials request. The method always 1155// closes the http.Response Body. 1156func (client ApplicationsClient) UpdatePasswordCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { 1157 err = autorest.Respond( 1158 resp, 1159 client.ByInspecting(), 1160 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 1161 autorest.ByClosing()) 1162 result.Response = resp 1163 return 1164} 1165