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 using a custom
40// endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure
41// stack).
42func NewAPIDiagnosticLoggerClientWithBaseURI(baseURI string, subscriptionID string) APIDiagnosticLoggerClient {
43	return APIDiagnosticLoggerClient{NewWithBaseURI(baseURI, subscriptionID)}
44}
45
46// CheckEntityExists checks that logger entity specified by identifier is associated with the diagnostics entity.
47// Parameters:
48// resourceGroupName - the name of the resource group.
49// serviceName - the name of the API Management service.
50// apiid - API identifier. Must be unique in the current API Management service instance.
51// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance.
52// loggerid - logger identifier. Must be unique in the API Management service instance.
53func (client APIDiagnosticLoggerClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, loggerid string) (result autorest.Response, err error) {
54	if tracing.IsEnabled() {
55		ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticLoggerClient.CheckEntityExists")
56		defer func() {
57			sc := -1
58			if result.Response != nil {
59				sc = result.Response.StatusCode
60			}
61			tracing.EndSpan(ctx, sc, err)
62		}()
63	}
64	if err := validation.Validate([]validation.Validation{
65		{TargetValue: serviceName,
66			Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
67				{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
68				{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
69		{TargetValue: apiid,
70			Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil},
71				{Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil},
72				{Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}},
73		{TargetValue: diagnosticID,
74			Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 256, Chain: nil},
75				{Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil},
76				{Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}},
77		{TargetValue: loggerid,
78			Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil},
79				{Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil {
80		return result, validation.NewError("apimanagement.APIDiagnosticLoggerClient", "CheckEntityExists", err.Error())
81	}
82
83	req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, loggerid)
84	if err != nil {
85		err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "CheckEntityExists", nil, "Failure preparing request")
86		return
87	}
88
89	resp, err := client.CheckEntityExistsSender(req)
90	if err != nil {
91		result.Response = resp
92		err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "CheckEntityExists", resp, "Failure sending request")
93		return
94	}
95
96	result, err = client.CheckEntityExistsResponder(resp)
97	if err != nil {
98		err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "CheckEntityExists", resp, "Failure responding to request")
99	}
100
101	return
102}
103
104// CheckEntityExistsPreparer prepares the CheckEntityExists request.
105func (client APIDiagnosticLoggerClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, loggerid string) (*http.Request, error) {
106	pathParameters := map[string]interface{}{
107		"apiId":             autorest.Encode("path", apiid),
108		"diagnosticId":      autorest.Encode("path", diagnosticID),
109		"loggerid":          autorest.Encode("path", loggerid),
110		"resourceGroupName": autorest.Encode("path", resourceGroupName),
111		"serviceName":       autorest.Encode("path", serviceName),
112		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
113	}
114
115	const APIVersion = "2017-03-01"
116	queryParameters := map[string]interface{}{
117		"api-version": APIVersion,
118	}
119
120	preparer := autorest.CreatePreparer(
121		autorest.AsHead(),
122		autorest.WithBaseURL(client.BaseURI),
123		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}/loggers/{loggerid}", pathParameters),
124		autorest.WithQueryParameters(queryParameters))
125	return preparer.Prepare((&http.Request{}).WithContext(ctx))
126}
127
128// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the
129// http.Response Body if it receives an error.
130func (client APIDiagnosticLoggerClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) {
131	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
132}
133
134// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always
135// closes the http.Response Body.
136func (client APIDiagnosticLoggerClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) {
137	err = autorest.Respond(
138		resp,
139		client.ByInspecting(),
140		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
141		autorest.ByClosing())
142	result.Response = resp
143	return
144}
145
146// CreateOrUpdate attaches a logger to a diagnostic for an API.
147// Parameters:
148// resourceGroupName - the name of the resource group.
149// serviceName - the name of the API Management service.
150// apiid - API identifier. Must be unique in the current API Management service instance.
151// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance.
152// loggerid - logger identifier. Must be unique in the API Management service instance.
153func (client APIDiagnosticLoggerClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, loggerid string) (result LoggerContract, err error) {
154	if tracing.IsEnabled() {
155		ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticLoggerClient.CreateOrUpdate")
156		defer func() {
157			sc := -1
158			if result.Response.Response != nil {
159				sc = result.Response.Response.StatusCode
160			}
161			tracing.EndSpan(ctx, sc, err)
162		}()
163	}
164	if err := validation.Validate([]validation.Validation{
165		{TargetValue: serviceName,
166			Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
167				{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
168				{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
169		{TargetValue: apiid,
170			Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil},
171				{Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil},
172				{Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}},
173		{TargetValue: diagnosticID,
174			Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 256, Chain: nil},
175				{Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil},
176				{Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}},
177		{TargetValue: loggerid,
178			Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil},
179				{Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil {
180		return result, validation.NewError("apimanagement.APIDiagnosticLoggerClient", "CreateOrUpdate", err.Error())
181	}
182
183	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, loggerid)
184	if err != nil {
185		err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "CreateOrUpdate", nil, "Failure preparing request")
186		return
187	}
188
189	resp, err := client.CreateOrUpdateSender(req)
190	if err != nil {
191		result.Response = autorest.Response{Response: resp}
192		err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "CreateOrUpdate", resp, "Failure sending request")
193		return
194	}
195
196	result, err = client.CreateOrUpdateResponder(resp)
197	if err != nil {
198		err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "CreateOrUpdate", resp, "Failure responding to request")
199	}
200
201	return
202}
203
204// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
205func (client APIDiagnosticLoggerClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, loggerid string) (*http.Request, error) {
206	pathParameters := map[string]interface{}{
207		"apiId":             autorest.Encode("path", apiid),
208		"diagnosticId":      autorest.Encode("path", diagnosticID),
209		"loggerid":          autorest.Encode("path", loggerid),
210		"resourceGroupName": autorest.Encode("path", resourceGroupName),
211		"serviceName":       autorest.Encode("path", serviceName),
212		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
213	}
214
215	const APIVersion = "2017-03-01"
216	queryParameters := map[string]interface{}{
217		"api-version": APIVersion,
218	}
219
220	preparer := autorest.CreatePreparer(
221		autorest.AsPut(),
222		autorest.WithBaseURL(client.BaseURI),
223		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}/loggers/{loggerid}", pathParameters),
224		autorest.WithQueryParameters(queryParameters))
225	return preparer.Prepare((&http.Request{}).WithContext(ctx))
226}
227
228// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
229// http.Response Body if it receives an error.
230func (client APIDiagnosticLoggerClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
231	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
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	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
333}
334
335// DeleteResponder handles the response to the Delete request. The method always
336// closes the http.Response Body.
337func (client APIDiagnosticLoggerClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
338	err = autorest.Respond(
339		resp,
340		client.ByInspecting(),
341		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
342		autorest.ByClosing())
343	result.Response = resp
344	return
345}
346
347// ListByService lists all loggers associated with the specified Diagnostic of an API.
348// Parameters:
349// resourceGroupName - the name of the resource group.
350// serviceName - the name of the API Management service.
351// apiid - API identifier. Must be unique in the current API Management service instance.
352// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance.
353// filter - | Field       | Supported operators    | Supported functions               |
354// |-------------|------------------------|-----------------------------------|
355// | id          | ge, le, eq, ne, gt, lt | substringof, startswith, endswith |
356// | type        | eq                     |                                   |
357// top - number of records to return.
358// skip - number of records to skip.
359func (client APIDiagnosticLoggerClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, filter string, top *int32, skip *int32) (result LoggerCollectionPage, err error) {
360	if tracing.IsEnabled() {
361		ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticLoggerClient.ListByService")
362		defer func() {
363			sc := -1
364			if result.lc.Response.Response != nil {
365				sc = result.lc.Response.Response.StatusCode
366			}
367			tracing.EndSpan(ctx, sc, err)
368		}()
369	}
370	if err := validation.Validate([]validation.Validation{
371		{TargetValue: serviceName,
372			Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
373				{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
374				{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
375		{TargetValue: apiid,
376			Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil},
377				{Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil},
378				{Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}},
379		{TargetValue: diagnosticID,
380			Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 256, Chain: nil},
381				{Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil},
382				{Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}},
383		{TargetValue: top,
384			Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false,
385				Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}},
386		{TargetValue: skip,
387			Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false,
388				Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil {
389		return result, validation.NewError("apimanagement.APIDiagnosticLoggerClient", "ListByService", err.Error())
390	}
391
392	result.fn = client.listByServiceNextResults
393	req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, filter, top, skip)
394	if err != nil {
395		err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "ListByService", nil, "Failure preparing request")
396		return
397	}
398
399	resp, err := client.ListByServiceSender(req)
400	if err != nil {
401		result.lc.Response = autorest.Response{Response: resp}
402		err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "ListByService", resp, "Failure sending request")
403		return
404	}
405
406	result.lc, err = client.ListByServiceResponder(resp)
407	if err != nil {
408		err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "ListByService", resp, "Failure responding to request")
409	}
410
411	return
412}
413
414// ListByServicePreparer prepares the ListByService request.
415func (client APIDiagnosticLoggerClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, filter string, top *int32, skip *int32) (*http.Request, error) {
416	pathParameters := map[string]interface{}{
417		"apiId":             autorest.Encode("path", apiid),
418		"diagnosticId":      autorest.Encode("path", diagnosticID),
419		"resourceGroupName": autorest.Encode("path", resourceGroupName),
420		"serviceName":       autorest.Encode("path", serviceName),
421		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
422	}
423
424	const APIVersion = "2017-03-01"
425	queryParameters := map[string]interface{}{
426		"api-version": APIVersion,
427	}
428	if len(filter) > 0 {
429		queryParameters["$filter"] = autorest.Encode("query", filter)
430	}
431	if top != nil {
432		queryParameters["$top"] = autorest.Encode("query", *top)
433	}
434	if skip != nil {
435		queryParameters["$skip"] = autorest.Encode("query", *skip)
436	}
437
438	preparer := autorest.CreatePreparer(
439		autorest.AsGet(),
440		autorest.WithBaseURL(client.BaseURI),
441		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}/loggers", pathParameters),
442		autorest.WithQueryParameters(queryParameters))
443	return preparer.Prepare((&http.Request{}).WithContext(ctx))
444}
445
446// ListByServiceSender sends the ListByService request. The method will close the
447// http.Response Body if it receives an error.
448func (client APIDiagnosticLoggerClient) ListByServiceSender(req *http.Request) (*http.Response, error) {
449	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
450}
451
452// ListByServiceResponder handles the response to the ListByService request. The method always
453// closes the http.Response Body.
454func (client APIDiagnosticLoggerClient) ListByServiceResponder(resp *http.Response) (result LoggerCollection, err error) {
455	err = autorest.Respond(
456		resp,
457		client.ByInspecting(),
458		azure.WithErrorUnlessStatusCode(http.StatusOK),
459		autorest.ByUnmarshallingJSON(&result),
460		autorest.ByClosing())
461	result.Response = autorest.Response{Response: resp}
462	return
463}
464
465// listByServiceNextResults retrieves the next set of results, if any.
466func (client APIDiagnosticLoggerClient) listByServiceNextResults(ctx context.Context, lastResults LoggerCollection) (result LoggerCollection, err error) {
467	req, err := lastResults.loggerCollectionPreparer(ctx)
468	if err != nil {
469		return result, autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "listByServiceNextResults", nil, "Failure preparing next results request")
470	}
471	if req == nil {
472		return
473	}
474	resp, err := client.ListByServiceSender(req)
475	if err != nil {
476		result.Response = autorest.Response{Response: resp}
477		return result, autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "listByServiceNextResults", resp, "Failure sending next results request")
478	}
479	result, err = client.ListByServiceResponder(resp)
480	if err != nil {
481		err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticLoggerClient", "listByServiceNextResults", resp, "Failure responding to next results request")
482	}
483	return
484}
485
486// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required.
487func (client APIDiagnosticLoggerClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, filter string, top *int32, skip *int32) (result LoggerCollectionIterator, err error) {
488	if tracing.IsEnabled() {
489		ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticLoggerClient.ListByService")
490		defer func() {
491			sc := -1
492			if result.Response().Response.Response != nil {
493				sc = result.page.Response().Response.Response.StatusCode
494			}
495			tracing.EndSpan(ctx, sc, err)
496		}()
497	}
498	result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, apiid, diagnosticID, filter, top, skip)
499	return
500}
501