1package cdn
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// AFDOriginsClient is the cdn Management Client
19type AFDOriginsClient struct {
20	BaseClient
21}
22
23// NewAFDOriginsClient creates an instance of the AFDOriginsClient client.
24func NewAFDOriginsClient(subscriptionID string) AFDOriginsClient {
25	return NewAFDOriginsClientWithBaseURI(DefaultBaseURI, subscriptionID)
26}
27
28// NewAFDOriginsClientWithBaseURI creates an instance of the AFDOriginsClient client using a custom endpoint.  Use this
29// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
30func NewAFDOriginsClientWithBaseURI(baseURI string, subscriptionID string) AFDOriginsClient {
31	return AFDOriginsClient{NewWithBaseURI(baseURI, subscriptionID)}
32}
33
34// Create creates a new origin within the specified origin group.
35// Parameters:
36// resourceGroupName - name of the Resource group within the Azure subscription.
37// profileName - name of the CDN profile which is unique within the resource group.
38// originGroupName - name of the origin group which is unique within the profile.
39// originName - name of the origin that is unique within the profile.
40// origin - origin properties
41func (client AFDOriginsClient) Create(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, origin AFDOrigin) (result AFDOriginsCreateFuture, err error) {
42	if tracing.IsEnabled() {
43		ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.Create")
44		defer func() {
45			sc := -1
46			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
47				sc = result.FutureAPI.Response().StatusCode
48			}
49			tracing.EndSpan(ctx, sc, err)
50		}()
51	}
52	if err := validation.Validate([]validation.Validation{
53		{TargetValue: resourceGroupName,
54			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
55				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
56				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
57		{TargetValue: origin,
58			Constraints: []validation.Constraint{{Target: "origin.AFDOriginProperties", Name: validation.Null, Rule: false,
59				Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.HostName", Name: validation.Null, Rule: true, Chain: nil},
60					{Target: "origin.AFDOriginProperties.HTTPPort", Name: validation.Null, Rule: false,
61						Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.HTTPPort", Name: validation.InclusiveMaximum, Rule: int64(65535), Chain: nil},
62							{Target: "origin.AFDOriginProperties.HTTPPort", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
63						}},
64					{Target: "origin.AFDOriginProperties.HTTPSPort", Name: validation.Null, Rule: false,
65						Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.HTTPSPort", Name: validation.InclusiveMaximum, Rule: int64(65535), Chain: nil},
66							{Target: "origin.AFDOriginProperties.HTTPSPort", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
67						}},
68					{Target: "origin.AFDOriginProperties.Priority", Name: validation.Null, Rule: false,
69						Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.Priority", Name: validation.InclusiveMaximum, Rule: int64(5), Chain: nil},
70							{Target: "origin.AFDOriginProperties.Priority", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
71						}},
72					{Target: "origin.AFDOriginProperties.Weight", Name: validation.Null, Rule: false,
73						Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.Weight", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil},
74							{Target: "origin.AFDOriginProperties.Weight", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
75						}},
76				}}}}}); err != nil {
77		return result, validation.NewError("cdn.AFDOriginsClient", "Create", err.Error())
78	}
79
80	req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, originGroupName, originName, origin)
81	if err != nil {
82		err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Create", nil, "Failure preparing request")
83		return
84	}
85
86	result, err = client.CreateSender(req)
87	if err != nil {
88		err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Create", nil, "Failure sending request")
89		return
90	}
91
92	return
93}
94
95// CreatePreparer prepares the Create request.
96func (client AFDOriginsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, origin AFDOrigin) (*http.Request, error) {
97	pathParameters := map[string]interface{}{
98		"originGroupName":   autorest.Encode("path", originGroupName),
99		"originName":        autorest.Encode("path", originName),
100		"profileName":       autorest.Encode("path", profileName),
101		"resourceGroupName": autorest.Encode("path", resourceGroupName),
102		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
103	}
104
105	const APIVersion = "2020-09-01"
106	queryParameters := map[string]interface{}{
107		"api-version": APIVersion,
108	}
109
110	preparer := autorest.CreatePreparer(
111		autorest.AsContentType("application/json; charset=utf-8"),
112		autorest.AsPut(),
113		autorest.WithBaseURL(client.BaseURI),
114		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", pathParameters),
115		autorest.WithJSON(origin),
116		autorest.WithQueryParameters(queryParameters))
117	return preparer.Prepare((&http.Request{}).WithContext(ctx))
118}
119
120// CreateSender sends the Create request. The method will close the
121// http.Response Body if it receives an error.
122func (client AFDOriginsClient) CreateSender(req *http.Request) (future AFDOriginsCreateFuture, err error) {
123	var resp *http.Response
124	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
125	if err != nil {
126		return
127	}
128	var azf azure.Future
129	azf, err = azure.NewFutureFromResponse(resp)
130	future.FutureAPI = &azf
131	future.Result = future.result
132	return
133}
134
135// CreateResponder handles the response to the Create request. The method always
136// closes the http.Response Body.
137func (client AFDOriginsClient) CreateResponder(resp *http.Response) (result AFDOrigin, err error) {
138	err = autorest.Respond(
139		resp,
140		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
141		autorest.ByUnmarshallingJSON(&result),
142		autorest.ByClosing())
143	result.Response = autorest.Response{Response: resp}
144	return
145}
146
147// Delete deletes an existing origin within an origin group.
148// Parameters:
149// resourceGroupName - name of the Resource group within the Azure subscription.
150// profileName - name of the CDN profile which is unique within the resource group.
151// originGroupName - name of the origin group which is unique within the profile.
152// originName - name of the origin which is unique within the profile.
153func (client AFDOriginsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (result AFDOriginsDeleteFuture, err error) {
154	if tracing.IsEnabled() {
155		ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.Delete")
156		defer func() {
157			sc := -1
158			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
159				sc = result.FutureAPI.Response().StatusCode
160			}
161			tracing.EndSpan(ctx, sc, err)
162		}()
163	}
164	if err := validation.Validate([]validation.Validation{
165		{TargetValue: resourceGroupName,
166			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
167				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
168				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
169		return result, validation.NewError("cdn.AFDOriginsClient", "Delete", err.Error())
170	}
171
172	req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, originGroupName, originName)
173	if err != nil {
174		err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Delete", nil, "Failure preparing request")
175		return
176	}
177
178	result, err = client.DeleteSender(req)
179	if err != nil {
180		err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Delete", nil, "Failure sending request")
181		return
182	}
183
184	return
185}
186
187// DeletePreparer prepares the Delete request.
188func (client AFDOriginsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (*http.Request, error) {
189	pathParameters := map[string]interface{}{
190		"originGroupName":   autorest.Encode("path", originGroupName),
191		"originName":        autorest.Encode("path", originName),
192		"profileName":       autorest.Encode("path", profileName),
193		"resourceGroupName": autorest.Encode("path", resourceGroupName),
194		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
195	}
196
197	const APIVersion = "2020-09-01"
198	queryParameters := map[string]interface{}{
199		"api-version": APIVersion,
200	}
201
202	preparer := autorest.CreatePreparer(
203		autorest.AsDelete(),
204		autorest.WithBaseURL(client.BaseURI),
205		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", pathParameters),
206		autorest.WithQueryParameters(queryParameters))
207	return preparer.Prepare((&http.Request{}).WithContext(ctx))
208}
209
210// DeleteSender sends the Delete request. The method will close the
211// http.Response Body if it receives an error.
212func (client AFDOriginsClient) DeleteSender(req *http.Request) (future AFDOriginsDeleteFuture, err error) {
213	var resp *http.Response
214	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
215	if err != nil {
216		return
217	}
218	var azf azure.Future
219	azf, err = azure.NewFutureFromResponse(resp)
220	future.FutureAPI = &azf
221	future.Result = future.result
222	return
223}
224
225// DeleteResponder handles the response to the Delete request. The method always
226// closes the http.Response Body.
227func (client AFDOriginsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
228	err = autorest.Respond(
229		resp,
230		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
231		autorest.ByClosing())
232	result.Response = resp
233	return
234}
235
236// Get gets an existing origin within an origin group.
237// Parameters:
238// resourceGroupName - name of the Resource group within the Azure subscription.
239// profileName - name of the CDN profile which is unique within the resource group.
240// originGroupName - name of the origin group which is unique within the profile.
241// originName - name of the origin which is unique within the profile.
242func (client AFDOriginsClient) Get(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (result AFDOrigin, err error) {
243	if tracing.IsEnabled() {
244		ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.Get")
245		defer func() {
246			sc := -1
247			if result.Response.Response != nil {
248				sc = result.Response.Response.StatusCode
249			}
250			tracing.EndSpan(ctx, sc, err)
251		}()
252	}
253	if err := validation.Validate([]validation.Validation{
254		{TargetValue: resourceGroupName,
255			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
256				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
257				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
258		return result, validation.NewError("cdn.AFDOriginsClient", "Get", err.Error())
259	}
260
261	req, err := client.GetPreparer(ctx, resourceGroupName, profileName, originGroupName, originName)
262	if err != nil {
263		err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Get", nil, "Failure preparing request")
264		return
265	}
266
267	resp, err := client.GetSender(req)
268	if err != nil {
269		result.Response = autorest.Response{Response: resp}
270		err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Get", resp, "Failure sending request")
271		return
272	}
273
274	result, err = client.GetResponder(resp)
275	if err != nil {
276		err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Get", resp, "Failure responding to request")
277		return
278	}
279
280	return
281}
282
283// GetPreparer prepares the Get request.
284func (client AFDOriginsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (*http.Request, error) {
285	pathParameters := map[string]interface{}{
286		"originGroupName":   autorest.Encode("path", originGroupName),
287		"originName":        autorest.Encode("path", originName),
288		"profileName":       autorest.Encode("path", profileName),
289		"resourceGroupName": autorest.Encode("path", resourceGroupName),
290		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
291	}
292
293	const APIVersion = "2020-09-01"
294	queryParameters := map[string]interface{}{
295		"api-version": APIVersion,
296	}
297
298	preparer := autorest.CreatePreparer(
299		autorest.AsGet(),
300		autorest.WithBaseURL(client.BaseURI),
301		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", pathParameters),
302		autorest.WithQueryParameters(queryParameters))
303	return preparer.Prepare((&http.Request{}).WithContext(ctx))
304}
305
306// GetSender sends the Get request. The method will close the
307// http.Response Body if it receives an error.
308func (client AFDOriginsClient) GetSender(req *http.Request) (*http.Response, error) {
309	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
310}
311
312// GetResponder handles the response to the Get request. The method always
313// closes the http.Response Body.
314func (client AFDOriginsClient) GetResponder(resp *http.Response) (result AFDOrigin, err error) {
315	err = autorest.Respond(
316		resp,
317		azure.WithErrorUnlessStatusCode(http.StatusOK),
318		autorest.ByUnmarshallingJSON(&result),
319		autorest.ByClosing())
320	result.Response = autorest.Response{Response: resp}
321	return
322}
323
324// ListByOriginGroup lists all of the existing origins within an origin group.
325// Parameters:
326// resourceGroupName - name of the Resource group within the Azure subscription.
327// profileName - name of the CDN profile which is unique within the resource group.
328// originGroupName - name of the origin group which is unique within the profile.
329func (client AFDOriginsClient) ListByOriginGroup(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result AFDOriginListResultPage, err error) {
330	if tracing.IsEnabled() {
331		ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.ListByOriginGroup")
332		defer func() {
333			sc := -1
334			if result.aolr.Response.Response != nil {
335				sc = result.aolr.Response.Response.StatusCode
336			}
337			tracing.EndSpan(ctx, sc, err)
338		}()
339	}
340	if err := validation.Validate([]validation.Validation{
341		{TargetValue: resourceGroupName,
342			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
343				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
344				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
345		return result, validation.NewError("cdn.AFDOriginsClient", "ListByOriginGroup", err.Error())
346	}
347
348	result.fn = client.listByOriginGroupNextResults
349	req, err := client.ListByOriginGroupPreparer(ctx, resourceGroupName, profileName, originGroupName)
350	if err != nil {
351		err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "ListByOriginGroup", nil, "Failure preparing request")
352		return
353	}
354
355	resp, err := client.ListByOriginGroupSender(req)
356	if err != nil {
357		result.aolr.Response = autorest.Response{Response: resp}
358		err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "ListByOriginGroup", resp, "Failure sending request")
359		return
360	}
361
362	result.aolr, err = client.ListByOriginGroupResponder(resp)
363	if err != nil {
364		err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "ListByOriginGroup", resp, "Failure responding to request")
365		return
366	}
367	if result.aolr.hasNextLink() && result.aolr.IsEmpty() {
368		err = result.NextWithContext(ctx)
369		return
370	}
371
372	return
373}
374
375// ListByOriginGroupPreparer prepares the ListByOriginGroup request.
376func (client AFDOriginsClient) ListByOriginGroupPreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (*http.Request, error) {
377	pathParameters := map[string]interface{}{
378		"originGroupName":   autorest.Encode("path", originGroupName),
379		"profileName":       autorest.Encode("path", profileName),
380		"resourceGroupName": autorest.Encode("path", resourceGroupName),
381		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
382	}
383
384	const APIVersion = "2020-09-01"
385	queryParameters := map[string]interface{}{
386		"api-version": APIVersion,
387	}
388
389	preparer := autorest.CreatePreparer(
390		autorest.AsGet(),
391		autorest.WithBaseURL(client.BaseURI),
392		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins", pathParameters),
393		autorest.WithQueryParameters(queryParameters))
394	return preparer.Prepare((&http.Request{}).WithContext(ctx))
395}
396
397// ListByOriginGroupSender sends the ListByOriginGroup request. The method will close the
398// http.Response Body if it receives an error.
399func (client AFDOriginsClient) ListByOriginGroupSender(req *http.Request) (*http.Response, error) {
400	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
401}
402
403// ListByOriginGroupResponder handles the response to the ListByOriginGroup request. The method always
404// closes the http.Response Body.
405func (client AFDOriginsClient) ListByOriginGroupResponder(resp *http.Response) (result AFDOriginListResult, err error) {
406	err = autorest.Respond(
407		resp,
408		azure.WithErrorUnlessStatusCode(http.StatusOK),
409		autorest.ByUnmarshallingJSON(&result),
410		autorest.ByClosing())
411	result.Response = autorest.Response{Response: resp}
412	return
413}
414
415// listByOriginGroupNextResults retrieves the next set of results, if any.
416func (client AFDOriginsClient) listByOriginGroupNextResults(ctx context.Context, lastResults AFDOriginListResult) (result AFDOriginListResult, err error) {
417	req, err := lastResults.aFDOriginListResultPreparer(ctx)
418	if err != nil {
419		return result, autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "listByOriginGroupNextResults", nil, "Failure preparing next results request")
420	}
421	if req == nil {
422		return
423	}
424	resp, err := client.ListByOriginGroupSender(req)
425	if err != nil {
426		result.Response = autorest.Response{Response: resp}
427		return result, autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "listByOriginGroupNextResults", resp, "Failure sending next results request")
428	}
429	result, err = client.ListByOriginGroupResponder(resp)
430	if err != nil {
431		err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "listByOriginGroupNextResults", resp, "Failure responding to next results request")
432	}
433	return
434}
435
436// ListByOriginGroupComplete enumerates all values, automatically crossing page boundaries as required.
437func (client AFDOriginsClient) ListByOriginGroupComplete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result AFDOriginListResultIterator, err error) {
438	if tracing.IsEnabled() {
439		ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.ListByOriginGroup")
440		defer func() {
441			sc := -1
442			if result.Response().Response.Response != nil {
443				sc = result.page.Response().Response.Response.StatusCode
444			}
445			tracing.EndSpan(ctx, sc, err)
446		}()
447	}
448	result.page, err = client.ListByOriginGroup(ctx, resourceGroupName, profileName, originGroupName)
449	return
450}
451
452// Update updates an existing origin within an origin group.
453// Parameters:
454// resourceGroupName - name of the Resource group within the Azure subscription.
455// profileName - name of the CDN profile which is unique within the resource group.
456// originGroupName - name of the origin group which is unique within the profile.
457// originName - name of the origin which is unique within the profile.
458// originUpdateProperties - origin properties
459func (client AFDOriginsClient) Update(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, originUpdateProperties AFDOriginUpdateParameters) (result AFDOriginsUpdateFuture, err error) {
460	if tracing.IsEnabled() {
461		ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.Update")
462		defer func() {
463			sc := -1
464			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
465				sc = result.FutureAPI.Response().StatusCode
466			}
467			tracing.EndSpan(ctx, sc, err)
468		}()
469	}
470	if err := validation.Validate([]validation.Validation{
471		{TargetValue: resourceGroupName,
472			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
473				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
474				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
475		return result, validation.NewError("cdn.AFDOriginsClient", "Update", err.Error())
476	}
477
478	req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, originGroupName, originName, originUpdateProperties)
479	if err != nil {
480		err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Update", nil, "Failure preparing request")
481		return
482	}
483
484	result, err = client.UpdateSender(req)
485	if err != nil {
486		err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Update", nil, "Failure sending request")
487		return
488	}
489
490	return
491}
492
493// UpdatePreparer prepares the Update request.
494func (client AFDOriginsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, originUpdateProperties AFDOriginUpdateParameters) (*http.Request, error) {
495	pathParameters := map[string]interface{}{
496		"originGroupName":   autorest.Encode("path", originGroupName),
497		"originName":        autorest.Encode("path", originName),
498		"profileName":       autorest.Encode("path", profileName),
499		"resourceGroupName": autorest.Encode("path", resourceGroupName),
500		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
501	}
502
503	const APIVersion = "2020-09-01"
504	queryParameters := map[string]interface{}{
505		"api-version": APIVersion,
506	}
507
508	preparer := autorest.CreatePreparer(
509		autorest.AsContentType("application/json; charset=utf-8"),
510		autorest.AsPatch(),
511		autorest.WithBaseURL(client.BaseURI),
512		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", pathParameters),
513		autorest.WithJSON(originUpdateProperties),
514		autorest.WithQueryParameters(queryParameters))
515	return preparer.Prepare((&http.Request{}).WithContext(ctx))
516}
517
518// UpdateSender sends the Update request. The method will close the
519// http.Response Body if it receives an error.
520func (client AFDOriginsClient) UpdateSender(req *http.Request) (future AFDOriginsUpdateFuture, err error) {
521	var resp *http.Response
522	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
523	if err != nil {
524		return
525	}
526	var azf azure.Future
527	azf, err = azure.NewFutureFromResponse(resp)
528	future.FutureAPI = &azf
529	future.Result = future.result
530	return
531}
532
533// UpdateResponder handles the response to the Update request. The method always
534// closes the http.Response Body.
535func (client AFDOriginsClient) UpdateResponder(resp *http.Response) (result AFDOrigin, err error) {
536	err = autorest.Respond(
537		resp,
538		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
539		autorest.ByUnmarshallingJSON(&result),
540		autorest.ByClosing())
541	result.Response = autorest.Response{Response: resp}
542	return
543}
544