1package apimanagement 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/validation" 25 "github.com/Azure/go-autorest/tracing" 26 "net/http" 27) 28 29// APIDiagnosticLoggerClient is the apiManagement Client 30type APIDiagnosticLoggerClient struct { 31 BaseClient 32} 33 34// NewAPIDiagnosticLoggerClient creates an instance of the APIDiagnosticLoggerClient client. 35func NewAPIDiagnosticLoggerClient(subscriptionID string) APIDiagnosticLoggerClient { 36 return NewAPIDiagnosticLoggerClientWithBaseURI(DefaultBaseURI, subscriptionID) 37} 38 39// NewAPIDiagnosticLoggerClientWithBaseURI creates an instance of the APIDiagnosticLoggerClient client. 40func NewAPIDiagnosticLoggerClientWithBaseURI(baseURI string, subscriptionID string) APIDiagnosticLoggerClient { 41 return APIDiagnosticLoggerClient{NewWithBaseURI(baseURI, subscriptionID)} 42} 43 44// CheckEntityExists checks that logger entity specified by identifier is associated with the diagnostics entity. 45// Parameters: 46// resourceGroupName - the name of the resource group. 47// serviceName - the name of the API Management service. 48// apiid - API identifier. Must be unique in the current API Management service instance. 49// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. 50// loggerid - logger identifier. Must be unique in the API Management service instance. 51func (client APIDiagnosticLoggerClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, loggerid string) (result autorest.Response, err error) { 52 if tracing.IsEnabled() { 53 ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticLoggerClient.CheckEntityExists") 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: serviceName, 64 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 65 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 66 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 67 {TargetValue: apiid, 68 Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, 69 {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, 70 {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, 71 {TargetValue: diagnosticID, 72 Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 256, Chain: nil}, 73 {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, 74 {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, 75 {TargetValue: loggerid, 76 Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, 77 {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { 78 return result, validation.NewError("apimanagement.APIDiagnosticLoggerClient", "CheckEntityExists", err.Error()) 79 } 80 81 req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, loggerid) 82 if err != nil { 83 err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "CheckEntityExists", nil, "Failure preparing request") 84 return 85 } 86 87 resp, err := client.CheckEntityExistsSender(req) 88 if err != nil { 89 result.Response = resp 90 err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "CheckEntityExists", resp, "Failure sending request") 91 return 92 } 93 94 result, err = client.CheckEntityExistsResponder(resp) 95 if err != nil { 96 err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "CheckEntityExists", resp, "Failure responding to request") 97 } 98 99 return 100} 101 102// CheckEntityExistsPreparer prepares the CheckEntityExists request. 103func (client APIDiagnosticLoggerClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, loggerid string) (*http.Request, error) { 104 pathParameters := map[string]interface{}{ 105 "apiId": autorest.Encode("path", apiid), 106 "diagnosticId": autorest.Encode("path", diagnosticID), 107 "loggerid": autorest.Encode("path", loggerid), 108 "resourceGroupName": autorest.Encode("path", resourceGroupName), 109 "serviceName": autorest.Encode("path", serviceName), 110 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 111 } 112 113 const APIVersion = "2017-03-01" 114 queryParameters := map[string]interface{}{ 115 "api-version": APIVersion, 116 } 117 118 preparer := autorest.CreatePreparer( 119 autorest.AsHead(), 120 autorest.WithBaseURL(client.BaseURI), 121 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}/loggers/{loggerid}", pathParameters), 122 autorest.WithQueryParameters(queryParameters)) 123 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 124} 125 126// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the 127// http.Response Body if it receives an error. 128func (client APIDiagnosticLoggerClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { 129 sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) 130 return autorest.SendWithSender(client, req, sd...) 131} 132 133// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always 134// closes the http.Response Body. 135func (client APIDiagnosticLoggerClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { 136 err = autorest.Respond( 137 resp, 138 client.ByInspecting(), 139 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 140 autorest.ByClosing()) 141 result.Response = resp 142 return 143} 144 145// CreateOrUpdate attaches a logger to a diagnostic for an API. 146// Parameters: 147// resourceGroupName - the name of the resource group. 148// serviceName - the name of the API Management service. 149// apiid - API identifier. Must be unique in the current API Management service instance. 150// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. 151// loggerid - logger identifier. Must be unique in the API Management service instance. 152func (client APIDiagnosticLoggerClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, loggerid string) (result LoggerContract, err error) { 153 if tracing.IsEnabled() { 154 ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticLoggerClient.CreateOrUpdate") 155 defer func() { 156 sc := -1 157 if result.Response.Response != nil { 158 sc = result.Response.Response.StatusCode 159 } 160 tracing.EndSpan(ctx, sc, err) 161 }() 162 } 163 if err := validation.Validate([]validation.Validation{ 164 {TargetValue: serviceName, 165 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 166 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 167 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 168 {TargetValue: apiid, 169 Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, 170 {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, 171 {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, 172 {TargetValue: diagnosticID, 173 Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 256, Chain: nil}, 174 {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, 175 {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, 176 {TargetValue: loggerid, 177 Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, 178 {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { 179 return result, validation.NewError("apimanagement.APIDiagnosticLoggerClient", "CreateOrUpdate", err.Error()) 180 } 181 182 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, loggerid) 183 if err != nil { 184 err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "CreateOrUpdate", nil, "Failure preparing request") 185 return 186 } 187 188 resp, err := client.CreateOrUpdateSender(req) 189 if err != nil { 190 result.Response = autorest.Response{Response: resp} 191 err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "CreateOrUpdate", resp, "Failure sending request") 192 return 193 } 194 195 result, err = client.CreateOrUpdateResponder(resp) 196 if err != nil { 197 err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "CreateOrUpdate", resp, "Failure responding to request") 198 } 199 200 return 201} 202 203// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 204func (client APIDiagnosticLoggerClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, loggerid string) (*http.Request, error) { 205 pathParameters := map[string]interface{}{ 206 "apiId": autorest.Encode("path", apiid), 207 "diagnosticId": autorest.Encode("path", diagnosticID), 208 "loggerid": autorest.Encode("path", loggerid), 209 "resourceGroupName": autorest.Encode("path", resourceGroupName), 210 "serviceName": autorest.Encode("path", serviceName), 211 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 212 } 213 214 const APIVersion = "2017-03-01" 215 queryParameters := map[string]interface{}{ 216 "api-version": APIVersion, 217 } 218 219 preparer := autorest.CreatePreparer( 220 autorest.AsPut(), 221 autorest.WithBaseURL(client.BaseURI), 222 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}/loggers/{loggerid}", pathParameters), 223 autorest.WithQueryParameters(queryParameters)) 224 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 225} 226 227// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 228// http.Response Body if it receives an error. 229func (client APIDiagnosticLoggerClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { 230 sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) 231 return autorest.SendWithSender(client, req, sd...) 232} 233 234// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 235// closes the http.Response Body. 236func (client APIDiagnosticLoggerClient) CreateOrUpdateResponder(resp *http.Response) (result LoggerContract, err error) { 237 err = autorest.Respond( 238 resp, 239 client.ByInspecting(), 240 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 241 autorest.ByUnmarshallingJSON(&result), 242 autorest.ByClosing()) 243 result.Response = autorest.Response{Response: resp} 244 return 245} 246 247// Delete deletes the specified Logger from Diagnostic for an API. 248// Parameters: 249// resourceGroupName - the name of the resource group. 250// serviceName - the name of the API Management service. 251// apiid - API identifier. Must be unique in the current API Management service instance. 252// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. 253// loggerid - logger identifier. Must be unique in the API Management service instance. 254func (client APIDiagnosticLoggerClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, loggerid string) (result autorest.Response, err error) { 255 if tracing.IsEnabled() { 256 ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticLoggerClient.Delete") 257 defer func() { 258 sc := -1 259 if result.Response != nil { 260 sc = result.Response.StatusCode 261 } 262 tracing.EndSpan(ctx, sc, err) 263 }() 264 } 265 if err := validation.Validate([]validation.Validation{ 266 {TargetValue: serviceName, 267 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 268 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 269 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 270 {TargetValue: apiid, 271 Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, 272 {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, 273 {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, 274 {TargetValue: diagnosticID, 275 Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 256, Chain: nil}, 276 {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, 277 {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, 278 {TargetValue: loggerid, 279 Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, 280 {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { 281 return result, validation.NewError("apimanagement.APIDiagnosticLoggerClient", "Delete", err.Error()) 282 } 283 284 req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, loggerid) 285 if err != nil { 286 err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "Delete", nil, "Failure preparing request") 287 return 288 } 289 290 resp, err := client.DeleteSender(req) 291 if err != nil { 292 result.Response = resp 293 err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "Delete", resp, "Failure sending request") 294 return 295 } 296 297 result, err = client.DeleteResponder(resp) 298 if err != nil { 299 err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "Delete", resp, "Failure responding to request") 300 } 301 302 return 303} 304 305// DeletePreparer prepares the Delete request. 306func (client APIDiagnosticLoggerClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, loggerid string) (*http.Request, error) { 307 pathParameters := map[string]interface{}{ 308 "apiId": autorest.Encode("path", apiid), 309 "diagnosticId": autorest.Encode("path", diagnosticID), 310 "loggerid": autorest.Encode("path", loggerid), 311 "resourceGroupName": autorest.Encode("path", resourceGroupName), 312 "serviceName": autorest.Encode("path", serviceName), 313 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 314 } 315 316 const APIVersion = "2017-03-01" 317 queryParameters := map[string]interface{}{ 318 "api-version": APIVersion, 319 } 320 321 preparer := autorest.CreatePreparer( 322 autorest.AsDelete(), 323 autorest.WithBaseURL(client.BaseURI), 324 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}/loggers/{loggerid}", pathParameters), 325 autorest.WithQueryParameters(queryParameters)) 326 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 327} 328 329// DeleteSender sends the Delete request. The method will close the 330// http.Response Body if it receives an error. 331func (client APIDiagnosticLoggerClient) DeleteSender(req *http.Request) (*http.Response, error) { 332 sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) 333 return autorest.SendWithSender(client, req, sd...) 334} 335 336// DeleteResponder handles the response to the Delete request. The method always 337// closes the http.Response Body. 338func (client APIDiagnosticLoggerClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 339 err = autorest.Respond( 340 resp, 341 client.ByInspecting(), 342 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 343 autorest.ByClosing()) 344 result.Response = resp 345 return 346} 347 348// ListByService lists all loggers associated with the specified Diagnostic of an API. 349// Parameters: 350// resourceGroupName - the name of the resource group. 351// serviceName - the name of the API Management service. 352// apiid - API identifier. Must be unique in the current API Management service instance. 353// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. 354// filter - | Field | Supported operators | Supported functions | 355// |-------------|------------------------|-----------------------------------| 356// | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | 357// | type | eq | | 358// top - number of records to return. 359// skip - number of records to skip. 360func (client APIDiagnosticLoggerClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, filter string, top *int32, skip *int32) (result LoggerCollectionPage, err error) { 361 if tracing.IsEnabled() { 362 ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticLoggerClient.ListByService") 363 defer func() { 364 sc := -1 365 if result.lc.Response.Response != nil { 366 sc = result.lc.Response.Response.StatusCode 367 } 368 tracing.EndSpan(ctx, sc, err) 369 }() 370 } 371 if err := validation.Validate([]validation.Validation{ 372 {TargetValue: serviceName, 373 Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 374 {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, 375 {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, 376 {TargetValue: apiid, 377 Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, 378 {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, 379 {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, 380 {TargetValue: diagnosticID, 381 Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 256, Chain: nil}, 382 {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, 383 {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, 384 {TargetValue: top, 385 Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, 386 Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, 387 {TargetValue: skip, 388 Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, 389 Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { 390 return result, validation.NewError("apimanagement.APIDiagnosticLoggerClient", "ListByService", err.Error()) 391 } 392 393 result.fn = client.listByServiceNextResults 394 req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, filter, top, skip) 395 if err != nil { 396 err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "ListByService", nil, "Failure preparing request") 397 return 398 } 399 400 resp, err := client.ListByServiceSender(req) 401 if err != nil { 402 result.lc.Response = autorest.Response{Response: resp} 403 err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "ListByService", resp, "Failure sending request") 404 return 405 } 406 407 result.lc, err = client.ListByServiceResponder(resp) 408 if err != nil { 409 err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "ListByService", resp, "Failure responding to request") 410 } 411 412 return 413} 414 415// ListByServicePreparer prepares the ListByService request. 416func (client APIDiagnosticLoggerClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, filter string, top *int32, skip *int32) (*http.Request, error) { 417 pathParameters := map[string]interface{}{ 418 "apiId": autorest.Encode("path", apiid), 419 "diagnosticId": autorest.Encode("path", diagnosticID), 420 "resourceGroupName": autorest.Encode("path", resourceGroupName), 421 "serviceName": autorest.Encode("path", serviceName), 422 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 423 } 424 425 const APIVersion = "2017-03-01" 426 queryParameters := map[string]interface{}{ 427 "api-version": APIVersion, 428 } 429 if len(filter) > 0 { 430 queryParameters["$filter"] = autorest.Encode("query", filter) 431 } 432 if top != nil { 433 queryParameters["$top"] = autorest.Encode("query", *top) 434 } 435 if skip != nil { 436 queryParameters["$skip"] = autorest.Encode("query", *skip) 437 } 438 439 preparer := autorest.CreatePreparer( 440 autorest.AsGet(), 441 autorest.WithBaseURL(client.BaseURI), 442 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}/loggers", pathParameters), 443 autorest.WithQueryParameters(queryParameters)) 444 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 445} 446 447// ListByServiceSender sends the ListByService request. The method will close the 448// http.Response Body if it receives an error. 449func (client APIDiagnosticLoggerClient) ListByServiceSender(req *http.Request) (*http.Response, error) { 450 sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) 451 return autorest.SendWithSender(client, req, sd...) 452} 453 454// ListByServiceResponder handles the response to the ListByService request. The method always 455// closes the http.Response Body. 456func (client APIDiagnosticLoggerClient) ListByServiceResponder(resp *http.Response) (result LoggerCollection, err error) { 457 err = autorest.Respond( 458 resp, 459 client.ByInspecting(), 460 azure.WithErrorUnlessStatusCode(http.StatusOK), 461 autorest.ByUnmarshallingJSON(&result), 462 autorest.ByClosing()) 463 result.Response = autorest.Response{Response: resp} 464 return 465} 466 467// listByServiceNextResults retrieves the next set of results, if any. 468func (client APIDiagnosticLoggerClient) listByServiceNextResults(ctx context.Context, lastResults LoggerCollection) (result LoggerCollection, err error) { 469 req, err := lastResults.loggerCollectionPreparer(ctx) 470 if err != nil { 471 return result, autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "listByServiceNextResults", nil, "Failure preparing next results request") 472 } 473 if req == nil { 474 return 475 } 476 resp, err := client.ListByServiceSender(req) 477 if err != nil { 478 result.Response = autorest.Response{Response: resp} 479 return result, autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "listByServiceNextResults", resp, "Failure sending next results request") 480 } 481 result, err = client.ListByServiceResponder(resp) 482 if err != nil { 483 err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "listByServiceNextResults", resp, "Failure responding to next results request") 484 } 485 return 486} 487 488// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. 489func (client APIDiagnosticLoggerClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, filter string, top *int32, skip *int32) (result LoggerCollectionIterator, err error) { 490 if tracing.IsEnabled() { 491 ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticLoggerClient.ListByService") 492 defer func() { 493 sc := -1 494 if result.Response().Response.Response != nil { 495 sc = result.page.Response().Response.Response.StatusCode 496 } 497 tracing.EndSpan(ctx, sc, err) 498 }() 499 } 500 result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, apiid, diagnosticID, filter, top, skip) 501 return 502} 503