1package apimanagement 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "github.com/Azure/go-autorest/autorest" 12 "github.com/Azure/go-autorest/autorest/azure" 13 "github.com/Azure/go-autorest/autorest/validation" 14 "github.com/Azure/go-autorest/tracing" 15 "net/http" 16) 17 18// LoggersClient is the apiManagement Client 19type LoggersClient struct { 20 BaseClient 21} 22 23// NewLoggersClient creates an instance of the LoggersClient client. 24func NewLoggersClient(subscriptionID string) LoggersClient { 25 return NewLoggersClientWithBaseURI(DefaultBaseURI, subscriptionID) 26} 27 28// NewLoggersClientWithBaseURI creates an instance of the LoggersClient client using a custom endpoint. Use this when 29// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 30func NewLoggersClientWithBaseURI(baseURI string, subscriptionID string) LoggersClient { 31 return LoggersClient{NewWithBaseURI(baseURI, subscriptionID)} 32} 33 34// CreateOrUpdate creates or Updates a logger. 35// Parameters: 36// resourceGroupName - the name of the resource group. 37// serviceName - the name of the API Management service. 38// loggerid - logger identifier. Must be unique in the API Management service instance. 39// parameters - create parameters. 40func (client LoggersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, loggerid string, parameters LoggerCreateParameters) (result autorest.Response, err error) { 41 if tracing.IsEnabled() { 42 ctx = tracing.StartSpan(ctx, fqdn+"/LoggersClient.CreateOrUpdate") 43 defer func() { 44 sc := -1 45 if result.Response != nil { 46 sc = result.Response.StatusCode 47 } 48 tracing.EndSpan(ctx, sc, err) 49 }() 50 } 51 if err := validation.Validate([]validation.Validation{ 52 {TargetValue: serviceName, 53 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 54 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 55 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 56 {TargetValue: loggerid, 57 Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, 58 {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, 59 {TargetValue: parameters, 60 Constraints: []validation.Constraint{{Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}, 61 {Target: "parameters.Credentials", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 62 return result, validation.NewError("apimanagement.LoggersClient", "CreateOrUpdate", err.Error()) 63 } 64 65 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, loggerid, parameters) 66 if err != nil { 67 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "CreateOrUpdate", nil, "Failure preparing request") 68 return 69 } 70 71 resp, err := client.CreateOrUpdateSender(req) 72 if err != nil { 73 result.Response = resp 74 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "CreateOrUpdate", resp, "Failure sending request") 75 return 76 } 77 78 result, err = client.CreateOrUpdateResponder(resp) 79 if err != nil { 80 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "CreateOrUpdate", resp, "Failure responding to request") 81 return 82 } 83 84 return 85} 86 87// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 88func (client LoggersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerid string, parameters LoggerCreateParameters) (*http.Request, error) { 89 pathParameters := map[string]interface{}{ 90 "loggerid": autorest.Encode("path", loggerid), 91 "resourceGroupName": autorest.Encode("path", resourceGroupName), 92 "serviceName": autorest.Encode("path", serviceName), 93 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 94 } 95 96 const APIVersion = "2016-10-10" 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.AsPut(), 104 autorest.WithBaseURL(client.BaseURI), 105 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerid}", pathParameters), 106 autorest.WithJSON(parameters), 107 autorest.WithQueryParameters(queryParameters)) 108 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 109} 110 111// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 112// http.Response Body if it receives an error. 113func (client LoggersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { 114 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 115} 116 117// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 118// closes the http.Response Body. 119func (client LoggersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { 120 err = autorest.Respond( 121 resp, 122 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), 123 autorest.ByClosing()) 124 result.Response = resp 125 return 126} 127 128// Delete deletes the specified logger. 129// Parameters: 130// resourceGroupName - the name of the resource group. 131// serviceName - the name of the API Management service. 132// loggerid - logger identifier. Must be unique in the API Management service instance. 133// ifMatch - the entity state (Etag) version of the logger to delete. A value of "*" can be used for If-Match 134// to unconditionally apply the operation. 135func (client LoggersClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, loggerid string, ifMatch string) (result autorest.Response, err error) { 136 if tracing.IsEnabled() { 137 ctx = tracing.StartSpan(ctx, fqdn+"/LoggersClient.Delete") 138 defer func() { 139 sc := -1 140 if result.Response != nil { 141 sc = result.Response.StatusCode 142 } 143 tracing.EndSpan(ctx, sc, err) 144 }() 145 } 146 if err := validation.Validate([]validation.Validation{ 147 {TargetValue: serviceName, 148 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 149 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 150 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 151 {TargetValue: loggerid, 152 Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, 153 {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { 154 return result, validation.NewError("apimanagement.LoggersClient", "Delete", err.Error()) 155 } 156 157 req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, loggerid, ifMatch) 158 if err != nil { 159 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Delete", nil, "Failure preparing request") 160 return 161 } 162 163 resp, err := client.DeleteSender(req) 164 if err != nil { 165 result.Response = resp 166 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Delete", resp, "Failure sending request") 167 return 168 } 169 170 result, err = client.DeleteResponder(resp) 171 if err != nil { 172 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Delete", resp, "Failure responding to request") 173 return 174 } 175 176 return 177} 178 179// DeletePreparer prepares the Delete request. 180func (client LoggersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerid string, ifMatch string) (*http.Request, error) { 181 pathParameters := map[string]interface{}{ 182 "loggerid": autorest.Encode("path", loggerid), 183 "resourceGroupName": autorest.Encode("path", resourceGroupName), 184 "serviceName": autorest.Encode("path", serviceName), 185 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 186 } 187 188 const APIVersion = "2016-10-10" 189 queryParameters := map[string]interface{}{ 190 "api-version": APIVersion, 191 } 192 193 preparer := autorest.CreatePreparer( 194 autorest.AsDelete(), 195 autorest.WithBaseURL(client.BaseURI), 196 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerid}", pathParameters), 197 autorest.WithQueryParameters(queryParameters), 198 autorest.WithHeader("If-Match", autorest.String(ifMatch))) 199 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 200} 201 202// DeleteSender sends the Delete request. The method will close the 203// http.Response Body if it receives an error. 204func (client LoggersClient) DeleteSender(req *http.Request) (*http.Response, error) { 205 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 206} 207 208// DeleteResponder handles the response to the Delete request. The method always 209// closes the http.Response Body. 210func (client LoggersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 211 err = autorest.Respond( 212 resp, 213 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 214 autorest.ByClosing()) 215 result.Response = resp 216 return 217} 218 219// Get gets the details of the logger specified by its identifier. 220// Parameters: 221// resourceGroupName - the name of the resource group. 222// serviceName - the name of the API Management service. 223// loggerid - logger identifier. Must be unique in the API Management service instance. 224func (client LoggersClient) Get(ctx context.Context, resourceGroupName string, serviceName string, loggerid string) (result LoggerResponse, err error) { 225 if tracing.IsEnabled() { 226 ctx = tracing.StartSpan(ctx, fqdn+"/LoggersClient.Get") 227 defer func() { 228 sc := -1 229 if result.Response.Response != nil { 230 sc = result.Response.Response.StatusCode 231 } 232 tracing.EndSpan(ctx, sc, err) 233 }() 234 } 235 if err := validation.Validate([]validation.Validation{ 236 {TargetValue: serviceName, 237 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 238 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 239 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 240 {TargetValue: loggerid, 241 Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, 242 {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { 243 return result, validation.NewError("apimanagement.LoggersClient", "Get", err.Error()) 244 } 245 246 req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, loggerid) 247 if err != nil { 248 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Get", nil, "Failure preparing request") 249 return 250 } 251 252 resp, err := client.GetSender(req) 253 if err != nil { 254 result.Response = autorest.Response{Response: resp} 255 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Get", resp, "Failure sending request") 256 return 257 } 258 259 result, err = client.GetResponder(resp) 260 if err != nil { 261 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Get", resp, "Failure responding to request") 262 return 263 } 264 265 return 266} 267 268// GetPreparer prepares the Get request. 269func (client LoggersClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerid string) (*http.Request, error) { 270 pathParameters := map[string]interface{}{ 271 "loggerid": autorest.Encode("path", loggerid), 272 "resourceGroupName": autorest.Encode("path", resourceGroupName), 273 "serviceName": autorest.Encode("path", serviceName), 274 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 275 } 276 277 const APIVersion = "2016-10-10" 278 queryParameters := map[string]interface{}{ 279 "api-version": APIVersion, 280 } 281 282 preparer := autorest.CreatePreparer( 283 autorest.AsGet(), 284 autorest.WithBaseURL(client.BaseURI), 285 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerid}", pathParameters), 286 autorest.WithQueryParameters(queryParameters)) 287 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 288} 289 290// GetSender sends the Get request. The method will close the 291// http.Response Body if it receives an error. 292func (client LoggersClient) GetSender(req *http.Request) (*http.Response, error) { 293 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 294} 295 296// GetResponder handles the response to the Get request. The method always 297// closes the http.Response Body. 298func (client LoggersClient) GetResponder(resp *http.Response) (result LoggerResponse, err error) { 299 err = autorest.Respond( 300 resp, 301 azure.WithErrorUnlessStatusCode(http.StatusOK), 302 autorest.ByUnmarshallingJSON(&result), 303 autorest.ByClosing()) 304 result.Response = autorest.Response{Response: resp} 305 return 306} 307 308// ListByService lists a collection of loggers in the specified service instance. 309// Parameters: 310// resourceGroupName - the name of the resource group. 311// serviceName - the name of the API Management service. 312// filter - | Field | Supported operators | Supported functions | 313// |-------|------------------------|---------------------------------------------| 314// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | 315// | type | eq | | 316// top - number of records to return. 317// skip - number of records to skip. 318func (client LoggersClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result LoggerCollectionPage, err error) { 319 if tracing.IsEnabled() { 320 ctx = tracing.StartSpan(ctx, fqdn+"/LoggersClient.ListByService") 321 defer func() { 322 sc := -1 323 if result.lc.Response.Response != nil { 324 sc = result.lc.Response.Response.StatusCode 325 } 326 tracing.EndSpan(ctx, sc, err) 327 }() 328 } 329 if err := validation.Validate([]validation.Validation{ 330 {TargetValue: serviceName, 331 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 332 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 333 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 334 {TargetValue: top, 335 Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, 336 Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, 337 {TargetValue: skip, 338 Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, 339 Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { 340 return result, validation.NewError("apimanagement.LoggersClient", "ListByService", err.Error()) 341 } 342 343 result.fn = client.listByServiceNextResults 344 req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) 345 if err != nil { 346 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", nil, "Failure preparing request") 347 return 348 } 349 350 resp, err := client.ListByServiceSender(req) 351 if err != nil { 352 result.lc.Response = autorest.Response{Response: resp} 353 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", resp, "Failure sending request") 354 return 355 } 356 357 result.lc, err = client.ListByServiceResponder(resp) 358 if err != nil { 359 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", resp, "Failure responding to request") 360 return 361 } 362 if result.lc.hasNextLink() && result.lc.IsEmpty() { 363 err = result.NextWithContext(ctx) 364 return 365 } 366 367 return 368} 369 370// ListByServicePreparer prepares the ListByService request. 371func (client LoggersClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { 372 pathParameters := map[string]interface{}{ 373 "resourceGroupName": autorest.Encode("path", resourceGroupName), 374 "serviceName": autorest.Encode("path", serviceName), 375 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 376 } 377 378 const APIVersion = "2016-10-10" 379 queryParameters := map[string]interface{}{ 380 "api-version": APIVersion, 381 } 382 if len(filter) > 0 { 383 queryParameters["$filter"] = autorest.Encode("query", filter) 384 } 385 if top != nil { 386 queryParameters["$top"] = autorest.Encode("query", *top) 387 } 388 if skip != nil { 389 queryParameters["$skip"] = autorest.Encode("query", *skip) 390 } 391 392 preparer := autorest.CreatePreparer( 393 autorest.AsGet(), 394 autorest.WithBaseURL(client.BaseURI), 395 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers", pathParameters), 396 autorest.WithQueryParameters(queryParameters)) 397 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 398} 399 400// ListByServiceSender sends the ListByService request. The method will close the 401// http.Response Body if it receives an error. 402func (client LoggersClient) ListByServiceSender(req *http.Request) (*http.Response, error) { 403 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 404} 405 406// ListByServiceResponder handles the response to the ListByService request. The method always 407// closes the http.Response Body. 408func (client LoggersClient) ListByServiceResponder(resp *http.Response) (result LoggerCollection, err error) { 409 err = autorest.Respond( 410 resp, 411 azure.WithErrorUnlessStatusCode(http.StatusOK), 412 autorest.ByUnmarshallingJSON(&result), 413 autorest.ByClosing()) 414 result.Response = autorest.Response{Response: resp} 415 return 416} 417 418// listByServiceNextResults retrieves the next set of results, if any. 419func (client LoggersClient) listByServiceNextResults(ctx context.Context, lastResults LoggerCollection) (result LoggerCollection, err error) { 420 req, err := lastResults.loggerCollectionPreparer(ctx) 421 if err != nil { 422 return result, autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "listByServiceNextResults", nil, "Failure preparing next results request") 423 } 424 if req == nil { 425 return 426 } 427 resp, err := client.ListByServiceSender(req) 428 if err != nil { 429 result.Response = autorest.Response{Response: resp} 430 return result, autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "listByServiceNextResults", resp, "Failure sending next results request") 431 } 432 result, err = client.ListByServiceResponder(resp) 433 if err != nil { 434 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "listByServiceNextResults", resp, "Failure responding to next results request") 435 } 436 return 437} 438 439// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. 440func (client LoggersClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result LoggerCollectionIterator, err error) { 441 if tracing.IsEnabled() { 442 ctx = tracing.StartSpan(ctx, fqdn+"/LoggersClient.ListByService") 443 defer func() { 444 sc := -1 445 if result.Response().Response.Response != nil { 446 sc = result.page.Response().Response.Response.StatusCode 447 } 448 tracing.EndSpan(ctx, sc, err) 449 }() 450 } 451 result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) 452 return 453} 454 455// Update updates an existing logger. 456// Parameters: 457// resourceGroupName - the name of the resource group. 458// serviceName - the name of the API Management service. 459// loggerid - logger identifier. Must be unique in the API Management service instance. 460// parameters - update parameters. 461// ifMatch - the entity state (Etag) version of the logger to update. A value of "*" can be used for If-Match 462// to unconditionally apply the operation. 463func (client LoggersClient) Update(ctx context.Context, resourceGroupName string, serviceName string, loggerid string, parameters LoggerUpdateParameters, ifMatch string) (result autorest.Response, err error) { 464 if tracing.IsEnabled() { 465 ctx = tracing.StartSpan(ctx, fqdn+"/LoggersClient.Update") 466 defer func() { 467 sc := -1 468 if result.Response != nil { 469 sc = result.Response.StatusCode 470 } 471 tracing.EndSpan(ctx, sc, err) 472 }() 473 } 474 if err := validation.Validate([]validation.Validation{ 475 {TargetValue: serviceName, 476 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 477 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 478 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 479 {TargetValue: loggerid, 480 Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, 481 {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { 482 return result, validation.NewError("apimanagement.LoggersClient", "Update", err.Error()) 483 } 484 485 req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, loggerid, parameters, ifMatch) 486 if err != nil { 487 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Update", nil, "Failure preparing request") 488 return 489 } 490 491 resp, err := client.UpdateSender(req) 492 if err != nil { 493 result.Response = resp 494 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Update", resp, "Failure sending request") 495 return 496 } 497 498 result, err = client.UpdateResponder(resp) 499 if err != nil { 500 err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Update", resp, "Failure responding to request") 501 return 502 } 503 504 return 505} 506 507// UpdatePreparer prepares the Update request. 508func (client LoggersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerid string, parameters LoggerUpdateParameters, ifMatch string) (*http.Request, error) { 509 pathParameters := map[string]interface{}{ 510 "loggerid": autorest.Encode("path", loggerid), 511 "resourceGroupName": autorest.Encode("path", resourceGroupName), 512 "serviceName": autorest.Encode("path", serviceName), 513 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 514 } 515 516 const APIVersion = "2016-10-10" 517 queryParameters := map[string]interface{}{ 518 "api-version": APIVersion, 519 } 520 521 preparer := autorest.CreatePreparer( 522 autorest.AsContentType("application/json; charset=utf-8"), 523 autorest.AsPatch(), 524 autorest.WithBaseURL(client.BaseURI), 525 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerid}", pathParameters), 526 autorest.WithJSON(parameters), 527 autorest.WithQueryParameters(queryParameters), 528 autorest.WithHeader("If-Match", autorest.String(ifMatch))) 529 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 530} 531 532// UpdateSender sends the Update request. The method will close the 533// http.Response Body if it receives an error. 534func (client LoggersClient) UpdateSender(req *http.Request) (*http.Response, error) { 535 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 536} 537 538// UpdateResponder handles the response to the Update request. The method always 539// closes the http.Response Body. 540func (client LoggersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { 541 err = autorest.Respond( 542 resp, 543 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 544 autorest.ByClosing()) 545 result.Response = resp 546 return 547} 548