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