1package web
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/tracing"
14	"net/http"
15)
16
17// CertificateOrdersClient is the webSite Management Client
18type CertificateOrdersClient struct {
19	BaseClient
20}
21
22// NewCertificateOrdersClient creates an instance of the CertificateOrdersClient client.
23func NewCertificateOrdersClient(subscriptionID string) CertificateOrdersClient {
24	return NewCertificateOrdersClientWithBaseURI(DefaultBaseURI, subscriptionID)
25}
26
27// NewCertificateOrdersClientWithBaseURI creates an instance of the CertificateOrdersClient client using a custom
28// endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure
29// stack).
30func NewCertificateOrdersClientWithBaseURI(baseURI string, subscriptionID string) CertificateOrdersClient {
31	return CertificateOrdersClient{NewWithBaseURI(baseURI, subscriptionID)}
32}
33
34// CreateOrUpdateCertificate sends the create or update certificate request.
35// Parameters:
36// resourceGroupName - azure resource group name
37// certificateOrderName - certificate name
38// name - certificate name
39// keyVaultCertificate - key Vault secret csm Id
40func (client CertificateOrdersClient) CreateOrUpdateCertificate(ctx context.Context, resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate CertificateOrderCertificate) (result CertificateOrderCertificate, err error) {
41	if tracing.IsEnabled() {
42		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.CreateOrUpdateCertificate")
43		defer func() {
44			sc := -1
45			if result.Response.Response != nil {
46				sc = result.Response.Response.StatusCode
47			}
48			tracing.EndSpan(ctx, sc, err)
49		}()
50	}
51	req, err := client.CreateOrUpdateCertificatePreparer(ctx, resourceGroupName, certificateOrderName, name, keyVaultCertificate)
52	if err != nil {
53		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "CreateOrUpdateCertificate", nil, "Failure preparing request")
54		return
55	}
56
57	resp, err := client.CreateOrUpdateCertificateSender(req)
58	if err != nil {
59		result.Response = autorest.Response{Response: resp}
60		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "CreateOrUpdateCertificate", resp, "Failure sending request")
61		return
62	}
63
64	result, err = client.CreateOrUpdateCertificateResponder(resp)
65	if err != nil {
66		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "CreateOrUpdateCertificate", resp, "Failure responding to request")
67		return
68	}
69
70	return
71}
72
73// CreateOrUpdateCertificatePreparer prepares the CreateOrUpdateCertificate request.
74func (client CertificateOrdersClient) CreateOrUpdateCertificatePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate CertificateOrderCertificate) (*http.Request, error) {
75	pathParameters := map[string]interface{}{
76		"certificateOrderName": autorest.Encode("path", certificateOrderName),
77		"name":                 autorest.Encode("path", name),
78		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
79		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
80	}
81
82	const APIVersion = "2015-08-01"
83	queryParameters := map[string]interface{}{
84		"api-version": APIVersion,
85	}
86
87	preparer := autorest.CreatePreparer(
88		autorest.AsContentType("application/json; charset=utf-8"),
89		autorest.AsPut(),
90		autorest.WithBaseURL(client.BaseURI),
91		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters),
92		autorest.WithJSON(keyVaultCertificate),
93		autorest.WithQueryParameters(queryParameters))
94	return preparer.Prepare((&http.Request{}).WithContext(ctx))
95}
96
97// CreateOrUpdateCertificateSender sends the CreateOrUpdateCertificate request. The method will close the
98// http.Response Body if it receives an error.
99func (client CertificateOrdersClient) CreateOrUpdateCertificateSender(req *http.Request) (*http.Response, error) {
100	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
101}
102
103// CreateOrUpdateCertificateResponder handles the response to the CreateOrUpdateCertificate request. The method always
104// closes the http.Response Body.
105func (client CertificateOrdersClient) CreateOrUpdateCertificateResponder(resp *http.Response) (result CertificateOrderCertificate, err error) {
106	err = autorest.Respond(
107		resp,
108		azure.WithErrorUnlessStatusCode(http.StatusOK),
109		autorest.ByUnmarshallingJSON(&result),
110		autorest.ByClosing())
111	result.Response = autorest.Response{Response: resp}
112	return
113}
114
115// CreateOrUpdateCertificateOrder sends the create or update certificate order request.
116// Parameters:
117// resourceGroupName - azure resource group name
118// name - certificate name
119// certificateDistinguishedName - distinguished name to be used for purchasing certificate
120func (client CertificateOrdersClient) CreateOrUpdateCertificateOrder(ctx context.Context, resourceGroupName string, name string, certificateDistinguishedName CertificateOrder) (result CertificateOrder, err error) {
121	if tracing.IsEnabled() {
122		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.CreateOrUpdateCertificateOrder")
123		defer func() {
124			sc := -1
125			if result.Response.Response != nil {
126				sc = result.Response.Response.StatusCode
127			}
128			tracing.EndSpan(ctx, sc, err)
129		}()
130	}
131	req, err := client.CreateOrUpdateCertificateOrderPreparer(ctx, resourceGroupName, name, certificateDistinguishedName)
132	if err != nil {
133		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "CreateOrUpdateCertificateOrder", nil, "Failure preparing request")
134		return
135	}
136
137	resp, err := client.CreateOrUpdateCertificateOrderSender(req)
138	if err != nil {
139		result.Response = autorest.Response{Response: resp}
140		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "CreateOrUpdateCertificateOrder", resp, "Failure sending request")
141		return
142	}
143
144	result, err = client.CreateOrUpdateCertificateOrderResponder(resp)
145	if err != nil {
146		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "CreateOrUpdateCertificateOrder", resp, "Failure responding to request")
147		return
148	}
149
150	return
151}
152
153// CreateOrUpdateCertificateOrderPreparer prepares the CreateOrUpdateCertificateOrder request.
154func (client CertificateOrdersClient) CreateOrUpdateCertificateOrderPreparer(ctx context.Context, resourceGroupName string, name string, certificateDistinguishedName CertificateOrder) (*http.Request, error) {
155	pathParameters := map[string]interface{}{
156		"name":              autorest.Encode("path", name),
157		"resourceGroupName": autorest.Encode("path", resourceGroupName),
158		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
159	}
160
161	const APIVersion = "2015-08-01"
162	queryParameters := map[string]interface{}{
163		"api-version": APIVersion,
164	}
165
166	preparer := autorest.CreatePreparer(
167		autorest.AsContentType("application/json; charset=utf-8"),
168		autorest.AsPut(),
169		autorest.WithBaseURL(client.BaseURI),
170		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}", pathParameters),
171		autorest.WithJSON(certificateDistinguishedName),
172		autorest.WithQueryParameters(queryParameters))
173	return preparer.Prepare((&http.Request{}).WithContext(ctx))
174}
175
176// CreateOrUpdateCertificateOrderSender sends the CreateOrUpdateCertificateOrder request. The method will close the
177// http.Response Body if it receives an error.
178func (client CertificateOrdersClient) CreateOrUpdateCertificateOrderSender(req *http.Request) (*http.Response, error) {
179	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
180}
181
182// CreateOrUpdateCertificateOrderResponder handles the response to the CreateOrUpdateCertificateOrder request. The method always
183// closes the http.Response Body.
184func (client CertificateOrdersClient) CreateOrUpdateCertificateOrderResponder(resp *http.Response) (result CertificateOrder, err error) {
185	err = autorest.Respond(
186		resp,
187		azure.WithErrorUnlessStatusCode(http.StatusOK),
188		autorest.ByUnmarshallingJSON(&result),
189		autorest.ByClosing())
190	result.Response = autorest.Response{Response: resp}
191	return
192}
193
194// DeleteCertificate sends the delete certificate request.
195// Parameters:
196// resourceGroupName - azure resource group name
197// certificateOrderName - certificate name
198// name - certificate name
199func (client CertificateOrdersClient) DeleteCertificate(ctx context.Context, resourceGroupName string, certificateOrderName string, name string) (result SetObject, err error) {
200	if tracing.IsEnabled() {
201		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.DeleteCertificate")
202		defer func() {
203			sc := -1
204			if result.Response.Response != nil {
205				sc = result.Response.Response.StatusCode
206			}
207			tracing.EndSpan(ctx, sc, err)
208		}()
209	}
210	req, err := client.DeleteCertificatePreparer(ctx, resourceGroupName, certificateOrderName, name)
211	if err != nil {
212		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "DeleteCertificate", nil, "Failure preparing request")
213		return
214	}
215
216	resp, err := client.DeleteCertificateSender(req)
217	if err != nil {
218		result.Response = autorest.Response{Response: resp}
219		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "DeleteCertificate", resp, "Failure sending request")
220		return
221	}
222
223	result, err = client.DeleteCertificateResponder(resp)
224	if err != nil {
225		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "DeleteCertificate", resp, "Failure responding to request")
226		return
227	}
228
229	return
230}
231
232// DeleteCertificatePreparer prepares the DeleteCertificate request.
233func (client CertificateOrdersClient) DeleteCertificatePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, name string) (*http.Request, error) {
234	pathParameters := map[string]interface{}{
235		"certificateOrderName": autorest.Encode("path", certificateOrderName),
236		"name":                 autorest.Encode("path", name),
237		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
238		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
239	}
240
241	const APIVersion = "2015-08-01"
242	queryParameters := map[string]interface{}{
243		"api-version": APIVersion,
244	}
245
246	preparer := autorest.CreatePreparer(
247		autorest.AsDelete(),
248		autorest.WithBaseURL(client.BaseURI),
249		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters),
250		autorest.WithQueryParameters(queryParameters))
251	return preparer.Prepare((&http.Request{}).WithContext(ctx))
252}
253
254// DeleteCertificateSender sends the DeleteCertificate request. The method will close the
255// http.Response Body if it receives an error.
256func (client CertificateOrdersClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) {
257	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
258}
259
260// DeleteCertificateResponder handles the response to the DeleteCertificate request. The method always
261// closes the http.Response Body.
262func (client CertificateOrdersClient) DeleteCertificateResponder(resp *http.Response) (result SetObject, err error) {
263	err = autorest.Respond(
264		resp,
265		azure.WithErrorUnlessStatusCode(http.StatusOK),
266		autorest.ByUnmarshallingJSON(&result.Value),
267		autorest.ByClosing())
268	result.Response = autorest.Response{Response: resp}
269	return
270}
271
272// DeleteCertificateOrder sends the delete certificate order request.
273// Parameters:
274// resourceGroupName - azure resource group name
275// name - certificate name
276func (client CertificateOrdersClient) DeleteCertificateOrder(ctx context.Context, resourceGroupName string, name string) (result SetObject, err error) {
277	if tracing.IsEnabled() {
278		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.DeleteCertificateOrder")
279		defer func() {
280			sc := -1
281			if result.Response.Response != nil {
282				sc = result.Response.Response.StatusCode
283			}
284			tracing.EndSpan(ctx, sc, err)
285		}()
286	}
287	req, err := client.DeleteCertificateOrderPreparer(ctx, resourceGroupName, name)
288	if err != nil {
289		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "DeleteCertificateOrder", nil, "Failure preparing request")
290		return
291	}
292
293	resp, err := client.DeleteCertificateOrderSender(req)
294	if err != nil {
295		result.Response = autorest.Response{Response: resp}
296		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "DeleteCertificateOrder", resp, "Failure sending request")
297		return
298	}
299
300	result, err = client.DeleteCertificateOrderResponder(resp)
301	if err != nil {
302		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "DeleteCertificateOrder", resp, "Failure responding to request")
303		return
304	}
305
306	return
307}
308
309// DeleteCertificateOrderPreparer prepares the DeleteCertificateOrder request.
310func (client CertificateOrdersClient) DeleteCertificateOrderPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) {
311	pathParameters := map[string]interface{}{
312		"name":              autorest.Encode("path", name),
313		"resourceGroupName": autorest.Encode("path", resourceGroupName),
314		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
315	}
316
317	const APIVersion = "2015-08-01"
318	queryParameters := map[string]interface{}{
319		"api-version": APIVersion,
320	}
321
322	preparer := autorest.CreatePreparer(
323		autorest.AsDelete(),
324		autorest.WithBaseURL(client.BaseURI),
325		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}", pathParameters),
326		autorest.WithQueryParameters(queryParameters))
327	return preparer.Prepare((&http.Request{}).WithContext(ctx))
328}
329
330// DeleteCertificateOrderSender sends the DeleteCertificateOrder request. The method will close the
331// http.Response Body if it receives an error.
332func (client CertificateOrdersClient) DeleteCertificateOrderSender(req *http.Request) (*http.Response, error) {
333	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
334}
335
336// DeleteCertificateOrderResponder handles the response to the DeleteCertificateOrder request. The method always
337// closes the http.Response Body.
338func (client CertificateOrdersClient) DeleteCertificateOrderResponder(resp *http.Response) (result SetObject, err error) {
339	err = autorest.Respond(
340		resp,
341		azure.WithErrorUnlessStatusCode(http.StatusOK),
342		autorest.ByUnmarshallingJSON(&result.Value),
343		autorest.ByClosing())
344	result.Response = autorest.Response{Response: resp}
345	return
346}
347
348// GetCertificate sends the get certificate request.
349// Parameters:
350// resourceGroupName - azure resource group name
351// certificateOrderName - certificate name
352// name - certificate name
353func (client CertificateOrdersClient) GetCertificate(ctx context.Context, resourceGroupName string, certificateOrderName string, name string) (result CertificateOrderCertificate, err error) {
354	if tracing.IsEnabled() {
355		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.GetCertificate")
356		defer func() {
357			sc := -1
358			if result.Response.Response != nil {
359				sc = result.Response.Response.StatusCode
360			}
361			tracing.EndSpan(ctx, sc, err)
362		}()
363	}
364	req, err := client.GetCertificatePreparer(ctx, resourceGroupName, certificateOrderName, name)
365	if err != nil {
366		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificate", nil, "Failure preparing request")
367		return
368	}
369
370	resp, err := client.GetCertificateSender(req)
371	if err != nil {
372		result.Response = autorest.Response{Response: resp}
373		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificate", resp, "Failure sending request")
374		return
375	}
376
377	result, err = client.GetCertificateResponder(resp)
378	if err != nil {
379		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificate", resp, "Failure responding to request")
380		return
381	}
382
383	return
384}
385
386// GetCertificatePreparer prepares the GetCertificate request.
387func (client CertificateOrdersClient) GetCertificatePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, name string) (*http.Request, error) {
388	pathParameters := map[string]interface{}{
389		"certificateOrderName": autorest.Encode("path", certificateOrderName),
390		"name":                 autorest.Encode("path", name),
391		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
392		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
393	}
394
395	const APIVersion = "2015-08-01"
396	queryParameters := map[string]interface{}{
397		"api-version": APIVersion,
398	}
399
400	preparer := autorest.CreatePreparer(
401		autorest.AsGet(),
402		autorest.WithBaseURL(client.BaseURI),
403		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters),
404		autorest.WithQueryParameters(queryParameters))
405	return preparer.Prepare((&http.Request{}).WithContext(ctx))
406}
407
408// GetCertificateSender sends the GetCertificate request. The method will close the
409// http.Response Body if it receives an error.
410func (client CertificateOrdersClient) GetCertificateSender(req *http.Request) (*http.Response, error) {
411	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
412}
413
414// GetCertificateResponder handles the response to the GetCertificate request. The method always
415// closes the http.Response Body.
416func (client CertificateOrdersClient) GetCertificateResponder(resp *http.Response) (result CertificateOrderCertificate, err error) {
417	err = autorest.Respond(
418		resp,
419		azure.WithErrorUnlessStatusCode(http.StatusOK),
420		autorest.ByUnmarshallingJSON(&result),
421		autorest.ByClosing())
422	result.Response = autorest.Response{Response: resp}
423	return
424}
425
426// GetCertificateOrder sends the get certificate order request.
427// Parameters:
428// resourceGroupName - azure resource group name
429// name - certificate name
430func (client CertificateOrdersClient) GetCertificateOrder(ctx context.Context, resourceGroupName string, name string) (result CertificateOrder, err error) {
431	if tracing.IsEnabled() {
432		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.GetCertificateOrder")
433		defer func() {
434			sc := -1
435			if result.Response.Response != nil {
436				sc = result.Response.Response.StatusCode
437			}
438			tracing.EndSpan(ctx, sc, err)
439		}()
440	}
441	req, err := client.GetCertificateOrderPreparer(ctx, resourceGroupName, name)
442	if err != nil {
443		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrder", nil, "Failure preparing request")
444		return
445	}
446
447	resp, err := client.GetCertificateOrderSender(req)
448	if err != nil {
449		result.Response = autorest.Response{Response: resp}
450		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrder", resp, "Failure sending request")
451		return
452	}
453
454	result, err = client.GetCertificateOrderResponder(resp)
455	if err != nil {
456		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrder", resp, "Failure responding to request")
457		return
458	}
459
460	return
461}
462
463// GetCertificateOrderPreparer prepares the GetCertificateOrder request.
464func (client CertificateOrdersClient) GetCertificateOrderPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) {
465	pathParameters := map[string]interface{}{
466		"name":              autorest.Encode("path", name),
467		"resourceGroupName": autorest.Encode("path", resourceGroupName),
468		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
469	}
470
471	const APIVersion = "2015-08-01"
472	queryParameters := map[string]interface{}{
473		"api-version": APIVersion,
474	}
475
476	preparer := autorest.CreatePreparer(
477		autorest.AsGet(),
478		autorest.WithBaseURL(client.BaseURI),
479		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}", pathParameters),
480		autorest.WithQueryParameters(queryParameters))
481	return preparer.Prepare((&http.Request{}).WithContext(ctx))
482}
483
484// GetCertificateOrderSender sends the GetCertificateOrder request. The method will close the
485// http.Response Body if it receives an error.
486func (client CertificateOrdersClient) GetCertificateOrderSender(req *http.Request) (*http.Response, error) {
487	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
488}
489
490// GetCertificateOrderResponder handles the response to the GetCertificateOrder request. The method always
491// closes the http.Response Body.
492func (client CertificateOrdersClient) GetCertificateOrderResponder(resp *http.Response) (result CertificateOrder, err error) {
493	err = autorest.Respond(
494		resp,
495		azure.WithErrorUnlessStatusCode(http.StatusOK),
496		autorest.ByUnmarshallingJSON(&result),
497		autorest.ByClosing())
498	result.Response = autorest.Response{Response: resp}
499	return
500}
501
502// GetCertificateOrders sends the get certificate orders request.
503// Parameters:
504// resourceGroupName - azure resource group name
505func (client CertificateOrdersClient) GetCertificateOrders(ctx context.Context, resourceGroupName string) (result CertificateOrderCollectionPage, err error) {
506	if tracing.IsEnabled() {
507		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.GetCertificateOrders")
508		defer func() {
509			sc := -1
510			if result.coc.Response.Response != nil {
511				sc = result.coc.Response.Response.StatusCode
512			}
513			tracing.EndSpan(ctx, sc, err)
514		}()
515	}
516	result.fn = client.getCertificateOrdersNextResults
517	req, err := client.GetCertificateOrdersPreparer(ctx, resourceGroupName)
518	if err != nil {
519		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrders", nil, "Failure preparing request")
520		return
521	}
522
523	resp, err := client.GetCertificateOrdersSender(req)
524	if err != nil {
525		result.coc.Response = autorest.Response{Response: resp}
526		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrders", resp, "Failure sending request")
527		return
528	}
529
530	result.coc, err = client.GetCertificateOrdersResponder(resp)
531	if err != nil {
532		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrders", resp, "Failure responding to request")
533		return
534	}
535	if result.coc.hasNextLink() && result.coc.IsEmpty() {
536		err = result.NextWithContext(ctx)
537		return
538	}
539
540	return
541}
542
543// GetCertificateOrdersPreparer prepares the GetCertificateOrders request.
544func (client CertificateOrdersClient) GetCertificateOrdersPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
545	pathParameters := map[string]interface{}{
546		"resourceGroupName": autorest.Encode("path", resourceGroupName),
547		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
548	}
549
550	const APIVersion = "2015-08-01"
551	queryParameters := map[string]interface{}{
552		"api-version": APIVersion,
553	}
554
555	preparer := autorest.CreatePreparer(
556		autorest.AsGet(),
557		autorest.WithBaseURL(client.BaseURI),
558		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders", pathParameters),
559		autorest.WithQueryParameters(queryParameters))
560	return preparer.Prepare((&http.Request{}).WithContext(ctx))
561}
562
563// GetCertificateOrdersSender sends the GetCertificateOrders request. The method will close the
564// http.Response Body if it receives an error.
565func (client CertificateOrdersClient) GetCertificateOrdersSender(req *http.Request) (*http.Response, error) {
566	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
567}
568
569// GetCertificateOrdersResponder handles the response to the GetCertificateOrders request. The method always
570// closes the http.Response Body.
571func (client CertificateOrdersClient) GetCertificateOrdersResponder(resp *http.Response) (result CertificateOrderCollection, err error) {
572	err = autorest.Respond(
573		resp,
574		azure.WithErrorUnlessStatusCode(http.StatusOK),
575		autorest.ByUnmarshallingJSON(&result),
576		autorest.ByClosing())
577	result.Response = autorest.Response{Response: resp}
578	return
579}
580
581// getCertificateOrdersNextResults retrieves the next set of results, if any.
582func (client CertificateOrdersClient) getCertificateOrdersNextResults(ctx context.Context, lastResults CertificateOrderCollection) (result CertificateOrderCollection, err error) {
583	req, err := lastResults.certificateOrderCollectionPreparer(ctx)
584	if err != nil {
585		return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "getCertificateOrdersNextResults", nil, "Failure preparing next results request")
586	}
587	if req == nil {
588		return
589	}
590	resp, err := client.GetCertificateOrdersSender(req)
591	if err != nil {
592		result.Response = autorest.Response{Response: resp}
593		return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "getCertificateOrdersNextResults", resp, "Failure sending next results request")
594	}
595	result, err = client.GetCertificateOrdersResponder(resp)
596	if err != nil {
597		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "getCertificateOrdersNextResults", resp, "Failure responding to next results request")
598	}
599	return
600}
601
602// GetCertificateOrdersComplete enumerates all values, automatically crossing page boundaries as required.
603func (client CertificateOrdersClient) GetCertificateOrdersComplete(ctx context.Context, resourceGroupName string) (result CertificateOrderCollectionIterator, err error) {
604	if tracing.IsEnabled() {
605		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.GetCertificateOrders")
606		defer func() {
607			sc := -1
608			if result.Response().Response.Response != nil {
609				sc = result.page.Response().Response.Response.StatusCode
610			}
611			tracing.EndSpan(ctx, sc, err)
612		}()
613	}
614	result.page, err = client.GetCertificateOrders(ctx, resourceGroupName)
615	return
616}
617
618// GetCertificates sends the get certificates request.
619// Parameters:
620// resourceGroupName - azure resource group name
621// certificateOrderName - certificate name
622func (client CertificateOrdersClient) GetCertificates(ctx context.Context, resourceGroupName string, certificateOrderName string) (result CertificateOrderCertificateCollectionPage, err error) {
623	if tracing.IsEnabled() {
624		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.GetCertificates")
625		defer func() {
626			sc := -1
627			if result.cocc.Response.Response != nil {
628				sc = result.cocc.Response.Response.StatusCode
629			}
630			tracing.EndSpan(ctx, sc, err)
631		}()
632	}
633	result.fn = client.getCertificatesNextResults
634	req, err := client.GetCertificatesPreparer(ctx, resourceGroupName, certificateOrderName)
635	if err != nil {
636		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificates", nil, "Failure preparing request")
637		return
638	}
639
640	resp, err := client.GetCertificatesSender(req)
641	if err != nil {
642		result.cocc.Response = autorest.Response{Response: resp}
643		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificates", resp, "Failure sending request")
644		return
645	}
646
647	result.cocc, err = client.GetCertificatesResponder(resp)
648	if err != nil {
649		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificates", resp, "Failure responding to request")
650		return
651	}
652	if result.cocc.hasNextLink() && result.cocc.IsEmpty() {
653		err = result.NextWithContext(ctx)
654		return
655	}
656
657	return
658}
659
660// GetCertificatesPreparer prepares the GetCertificates request.
661func (client CertificateOrdersClient) GetCertificatesPreparer(ctx context.Context, resourceGroupName string, certificateOrderName string) (*http.Request, error) {
662	pathParameters := map[string]interface{}{
663		"certificateOrderName": autorest.Encode("path", certificateOrderName),
664		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
665		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
666	}
667
668	const APIVersion = "2015-08-01"
669	queryParameters := map[string]interface{}{
670		"api-version": APIVersion,
671	}
672
673	preparer := autorest.CreatePreparer(
674		autorest.AsGet(),
675		autorest.WithBaseURL(client.BaseURI),
676		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates", pathParameters),
677		autorest.WithQueryParameters(queryParameters))
678	return preparer.Prepare((&http.Request{}).WithContext(ctx))
679}
680
681// GetCertificatesSender sends the GetCertificates request. The method will close the
682// http.Response Body if it receives an error.
683func (client CertificateOrdersClient) GetCertificatesSender(req *http.Request) (*http.Response, error) {
684	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
685}
686
687// GetCertificatesResponder handles the response to the GetCertificates request. The method always
688// closes the http.Response Body.
689func (client CertificateOrdersClient) GetCertificatesResponder(resp *http.Response) (result CertificateOrderCertificateCollection, err error) {
690	err = autorest.Respond(
691		resp,
692		azure.WithErrorUnlessStatusCode(http.StatusOK),
693		autorest.ByUnmarshallingJSON(&result),
694		autorest.ByClosing())
695	result.Response = autorest.Response{Response: resp}
696	return
697}
698
699// getCertificatesNextResults retrieves the next set of results, if any.
700func (client CertificateOrdersClient) getCertificatesNextResults(ctx context.Context, lastResults CertificateOrderCertificateCollection) (result CertificateOrderCertificateCollection, err error) {
701	req, err := lastResults.certificateOrderCertificateCollectionPreparer(ctx)
702	if err != nil {
703		return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "getCertificatesNextResults", nil, "Failure preparing next results request")
704	}
705	if req == nil {
706		return
707	}
708	resp, err := client.GetCertificatesSender(req)
709	if err != nil {
710		result.Response = autorest.Response{Response: resp}
711		return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "getCertificatesNextResults", resp, "Failure sending next results request")
712	}
713	result, err = client.GetCertificatesResponder(resp)
714	if err != nil {
715		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "getCertificatesNextResults", resp, "Failure responding to next results request")
716	}
717	return
718}
719
720// GetCertificatesComplete enumerates all values, automatically crossing page boundaries as required.
721func (client CertificateOrdersClient) GetCertificatesComplete(ctx context.Context, resourceGroupName string, certificateOrderName string) (result CertificateOrderCertificateCollectionIterator, err error) {
722	if tracing.IsEnabled() {
723		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.GetCertificates")
724		defer func() {
725			sc := -1
726			if result.Response().Response.Response != nil {
727				sc = result.page.Response().Response.Response.StatusCode
728			}
729			tracing.EndSpan(ctx, sc, err)
730		}()
731	}
732	result.page, err = client.GetCertificates(ctx, resourceGroupName, certificateOrderName)
733	return
734}
735
736// ReissueCertificateOrder sends the reissue certificate order request.
737// Parameters:
738// resourceGroupName - azure resource group name
739// name - certificate name
740// reissueCertificateOrderRequest - reissue parameters
741func (client CertificateOrdersClient) ReissueCertificateOrder(ctx context.Context, resourceGroupName string, name string, reissueCertificateOrderRequest ReissueCertificateOrderRequest) (result SetObject, err error) {
742	if tracing.IsEnabled() {
743		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.ReissueCertificateOrder")
744		defer func() {
745			sc := -1
746			if result.Response.Response != nil {
747				sc = result.Response.Response.StatusCode
748			}
749			tracing.EndSpan(ctx, sc, err)
750		}()
751	}
752	req, err := client.ReissueCertificateOrderPreparer(ctx, resourceGroupName, name, reissueCertificateOrderRequest)
753	if err != nil {
754		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "ReissueCertificateOrder", nil, "Failure preparing request")
755		return
756	}
757
758	resp, err := client.ReissueCertificateOrderSender(req)
759	if err != nil {
760		result.Response = autorest.Response{Response: resp}
761		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "ReissueCertificateOrder", resp, "Failure sending request")
762		return
763	}
764
765	result, err = client.ReissueCertificateOrderResponder(resp)
766	if err != nil {
767		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "ReissueCertificateOrder", resp, "Failure responding to request")
768		return
769	}
770
771	return
772}
773
774// ReissueCertificateOrderPreparer prepares the ReissueCertificateOrder request.
775func (client CertificateOrdersClient) ReissueCertificateOrderPreparer(ctx context.Context, resourceGroupName string, name string, reissueCertificateOrderRequest ReissueCertificateOrderRequest) (*http.Request, error) {
776	pathParameters := map[string]interface{}{
777		"name":              autorest.Encode("path", name),
778		"resourceGroupName": autorest.Encode("path", resourceGroupName),
779		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
780	}
781
782	const APIVersion = "2015-08-01"
783	queryParameters := map[string]interface{}{
784		"api-version": APIVersion,
785	}
786
787	preparer := autorest.CreatePreparer(
788		autorest.AsContentType("application/json; charset=utf-8"),
789		autorest.AsPost(),
790		autorest.WithBaseURL(client.BaseURI),
791		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/reissue", pathParameters),
792		autorest.WithJSON(reissueCertificateOrderRequest),
793		autorest.WithQueryParameters(queryParameters))
794	return preparer.Prepare((&http.Request{}).WithContext(ctx))
795}
796
797// ReissueCertificateOrderSender sends the ReissueCertificateOrder request. The method will close the
798// http.Response Body if it receives an error.
799func (client CertificateOrdersClient) ReissueCertificateOrderSender(req *http.Request) (*http.Response, error) {
800	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
801}
802
803// ReissueCertificateOrderResponder handles the response to the ReissueCertificateOrder request. The method always
804// closes the http.Response Body.
805func (client CertificateOrdersClient) ReissueCertificateOrderResponder(resp *http.Response) (result SetObject, err error) {
806	err = autorest.Respond(
807		resp,
808		azure.WithErrorUnlessStatusCode(http.StatusOK),
809		autorest.ByUnmarshallingJSON(&result.Value),
810		autorest.ByClosing())
811	result.Response = autorest.Response{Response: resp}
812	return
813}
814
815// RenewCertificateOrder sends the renew certificate order request.
816// Parameters:
817// resourceGroupName - azure resource group name
818// name - certificate name
819// renewCertificateOrderRequest - renew parameters
820func (client CertificateOrdersClient) RenewCertificateOrder(ctx context.Context, resourceGroupName string, name string, renewCertificateOrderRequest RenewCertificateOrderRequest) (result SetObject, err error) {
821	if tracing.IsEnabled() {
822		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.RenewCertificateOrder")
823		defer func() {
824			sc := -1
825			if result.Response.Response != nil {
826				sc = result.Response.Response.StatusCode
827			}
828			tracing.EndSpan(ctx, sc, err)
829		}()
830	}
831	req, err := client.RenewCertificateOrderPreparer(ctx, resourceGroupName, name, renewCertificateOrderRequest)
832	if err != nil {
833		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RenewCertificateOrder", nil, "Failure preparing request")
834		return
835	}
836
837	resp, err := client.RenewCertificateOrderSender(req)
838	if err != nil {
839		result.Response = autorest.Response{Response: resp}
840		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RenewCertificateOrder", resp, "Failure sending request")
841		return
842	}
843
844	result, err = client.RenewCertificateOrderResponder(resp)
845	if err != nil {
846		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RenewCertificateOrder", resp, "Failure responding to request")
847		return
848	}
849
850	return
851}
852
853// RenewCertificateOrderPreparer prepares the RenewCertificateOrder request.
854func (client CertificateOrdersClient) RenewCertificateOrderPreparer(ctx context.Context, resourceGroupName string, name string, renewCertificateOrderRequest RenewCertificateOrderRequest) (*http.Request, error) {
855	pathParameters := map[string]interface{}{
856		"name":              autorest.Encode("path", name),
857		"resourceGroupName": autorest.Encode("path", resourceGroupName),
858		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
859	}
860
861	const APIVersion = "2015-08-01"
862	queryParameters := map[string]interface{}{
863		"api-version": APIVersion,
864	}
865
866	preparer := autorest.CreatePreparer(
867		autorest.AsContentType("application/json; charset=utf-8"),
868		autorest.AsPost(),
869		autorest.WithBaseURL(client.BaseURI),
870		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/renew", pathParameters),
871		autorest.WithJSON(renewCertificateOrderRequest),
872		autorest.WithQueryParameters(queryParameters))
873	return preparer.Prepare((&http.Request{}).WithContext(ctx))
874}
875
876// RenewCertificateOrderSender sends the RenewCertificateOrder request. The method will close the
877// http.Response Body if it receives an error.
878func (client CertificateOrdersClient) RenewCertificateOrderSender(req *http.Request) (*http.Response, error) {
879	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
880}
881
882// RenewCertificateOrderResponder handles the response to the RenewCertificateOrder request. The method always
883// closes the http.Response Body.
884func (client CertificateOrdersClient) RenewCertificateOrderResponder(resp *http.Response) (result SetObject, err error) {
885	err = autorest.Respond(
886		resp,
887		azure.WithErrorUnlessStatusCode(http.StatusOK),
888		autorest.ByUnmarshallingJSON(&result.Value),
889		autorest.ByClosing())
890	result.Response = autorest.Response{Response: resp}
891	return
892}
893
894// ResendCertificateEmail sends the resend certificate email request.
895// Parameters:
896// resourceGroupName - azure resource group name
897// name - certificate order name
898func (client CertificateOrdersClient) ResendCertificateEmail(ctx context.Context, resourceGroupName string, name string) (result SetObject, err error) {
899	if tracing.IsEnabled() {
900		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.ResendCertificateEmail")
901		defer func() {
902			sc := -1
903			if result.Response.Response != nil {
904				sc = result.Response.Response.StatusCode
905			}
906			tracing.EndSpan(ctx, sc, err)
907		}()
908	}
909	req, err := client.ResendCertificateEmailPreparer(ctx, resourceGroupName, name)
910	if err != nil {
911		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "ResendCertificateEmail", nil, "Failure preparing request")
912		return
913	}
914
915	resp, err := client.ResendCertificateEmailSender(req)
916	if err != nil {
917		result.Response = autorest.Response{Response: resp}
918		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "ResendCertificateEmail", resp, "Failure sending request")
919		return
920	}
921
922	result, err = client.ResendCertificateEmailResponder(resp)
923	if err != nil {
924		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "ResendCertificateEmail", resp, "Failure responding to request")
925		return
926	}
927
928	return
929}
930
931// ResendCertificateEmailPreparer prepares the ResendCertificateEmail request.
932func (client CertificateOrdersClient) ResendCertificateEmailPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) {
933	pathParameters := map[string]interface{}{
934		"name":              autorest.Encode("path", name),
935		"resourceGroupName": autorest.Encode("path", resourceGroupName),
936		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
937	}
938
939	const APIVersion = "2015-08-01"
940	queryParameters := map[string]interface{}{
941		"api-version": APIVersion,
942	}
943
944	preparer := autorest.CreatePreparer(
945		autorest.AsPost(),
946		autorest.WithBaseURL(client.BaseURI),
947		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/resendEmail", pathParameters),
948		autorest.WithQueryParameters(queryParameters))
949	return preparer.Prepare((&http.Request{}).WithContext(ctx))
950}
951
952// ResendCertificateEmailSender sends the ResendCertificateEmail request. The method will close the
953// http.Response Body if it receives an error.
954func (client CertificateOrdersClient) ResendCertificateEmailSender(req *http.Request) (*http.Response, error) {
955	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
956}
957
958// ResendCertificateEmailResponder handles the response to the ResendCertificateEmail request. The method always
959// closes the http.Response Body.
960func (client CertificateOrdersClient) ResendCertificateEmailResponder(resp *http.Response) (result SetObject, err error) {
961	err = autorest.Respond(
962		resp,
963		azure.WithErrorUnlessStatusCode(http.StatusOK),
964		autorest.ByUnmarshallingJSON(&result.Value),
965		autorest.ByClosing())
966	result.Response = autorest.Response{Response: resp}
967	return
968}
969
970// RetrieveCertificateActions sends the retrieve certificate actions request.
971// Parameters:
972// resourceGroupName - azure resource group name
973// name - certificate order name
974func (client CertificateOrdersClient) RetrieveCertificateActions(ctx context.Context, resourceGroupName string, name string) (result ListCertificateOrderAction, err error) {
975	if tracing.IsEnabled() {
976		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.RetrieveCertificateActions")
977		defer func() {
978			sc := -1
979			if result.Response.Response != nil {
980				sc = result.Response.Response.StatusCode
981			}
982			tracing.EndSpan(ctx, sc, err)
983		}()
984	}
985	req, err := client.RetrieveCertificateActionsPreparer(ctx, resourceGroupName, name)
986	if err != nil {
987		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RetrieveCertificateActions", nil, "Failure preparing request")
988		return
989	}
990
991	resp, err := client.RetrieveCertificateActionsSender(req)
992	if err != nil {
993		result.Response = autorest.Response{Response: resp}
994		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RetrieveCertificateActions", resp, "Failure sending request")
995		return
996	}
997
998	result, err = client.RetrieveCertificateActionsResponder(resp)
999	if err != nil {
1000		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RetrieveCertificateActions", resp, "Failure responding to request")
1001		return
1002	}
1003
1004	return
1005}
1006
1007// RetrieveCertificateActionsPreparer prepares the RetrieveCertificateActions request.
1008func (client CertificateOrdersClient) RetrieveCertificateActionsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) {
1009	pathParameters := map[string]interface{}{
1010		"name":              autorest.Encode("path", name),
1011		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1012		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1013	}
1014
1015	const APIVersion = "2015-08-01"
1016	queryParameters := map[string]interface{}{
1017		"api-version": APIVersion,
1018	}
1019
1020	preparer := autorest.CreatePreparer(
1021		autorest.AsPost(),
1022		autorest.WithBaseURL(client.BaseURI),
1023		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions", pathParameters),
1024		autorest.WithQueryParameters(queryParameters))
1025	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1026}
1027
1028// RetrieveCertificateActionsSender sends the RetrieveCertificateActions request. The method will close the
1029// http.Response Body if it receives an error.
1030func (client CertificateOrdersClient) RetrieveCertificateActionsSender(req *http.Request) (*http.Response, error) {
1031	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1032}
1033
1034// RetrieveCertificateActionsResponder handles the response to the RetrieveCertificateActions request. The method always
1035// closes the http.Response Body.
1036func (client CertificateOrdersClient) RetrieveCertificateActionsResponder(resp *http.Response) (result ListCertificateOrderAction, err error) {
1037	err = autorest.Respond(
1038		resp,
1039		azure.WithErrorUnlessStatusCode(http.StatusOK),
1040		autorest.ByUnmarshallingJSON(&result.Value),
1041		autorest.ByClosing())
1042	result.Response = autorest.Response{Response: resp}
1043	return
1044}
1045
1046// RetrieveCertificateEmailHistory sends the retrieve certificate email history request.
1047// Parameters:
1048// resourceGroupName - azure resource group name
1049// name - certificate order name
1050func (client CertificateOrdersClient) RetrieveCertificateEmailHistory(ctx context.Context, resourceGroupName string, name string) (result ListCertificateEmail, err error) {
1051	if tracing.IsEnabled() {
1052		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.RetrieveCertificateEmailHistory")
1053		defer func() {
1054			sc := -1
1055			if result.Response.Response != nil {
1056				sc = result.Response.Response.StatusCode
1057			}
1058			tracing.EndSpan(ctx, sc, err)
1059		}()
1060	}
1061	req, err := client.RetrieveCertificateEmailHistoryPreparer(ctx, resourceGroupName, name)
1062	if err != nil {
1063		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RetrieveCertificateEmailHistory", nil, "Failure preparing request")
1064		return
1065	}
1066
1067	resp, err := client.RetrieveCertificateEmailHistorySender(req)
1068	if err != nil {
1069		result.Response = autorest.Response{Response: resp}
1070		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RetrieveCertificateEmailHistory", resp, "Failure sending request")
1071		return
1072	}
1073
1074	result, err = client.RetrieveCertificateEmailHistoryResponder(resp)
1075	if err != nil {
1076		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RetrieveCertificateEmailHistory", resp, "Failure responding to request")
1077		return
1078	}
1079
1080	return
1081}
1082
1083// RetrieveCertificateEmailHistoryPreparer prepares the RetrieveCertificateEmailHistory request.
1084func (client CertificateOrdersClient) RetrieveCertificateEmailHistoryPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) {
1085	pathParameters := map[string]interface{}{
1086		"name":              autorest.Encode("path", name),
1087		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1088		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1089	}
1090
1091	const APIVersion = "2015-08-01"
1092	queryParameters := map[string]interface{}{
1093		"api-version": APIVersion,
1094	}
1095
1096	preparer := autorest.CreatePreparer(
1097		autorest.AsPost(),
1098		autorest.WithBaseURL(client.BaseURI),
1099		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory", pathParameters),
1100		autorest.WithQueryParameters(queryParameters))
1101	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1102}
1103
1104// RetrieveCertificateEmailHistorySender sends the RetrieveCertificateEmailHistory request. The method will close the
1105// http.Response Body if it receives an error.
1106func (client CertificateOrdersClient) RetrieveCertificateEmailHistorySender(req *http.Request) (*http.Response, error) {
1107	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1108}
1109
1110// RetrieveCertificateEmailHistoryResponder handles the response to the RetrieveCertificateEmailHistory request. The method always
1111// closes the http.Response Body.
1112func (client CertificateOrdersClient) RetrieveCertificateEmailHistoryResponder(resp *http.Response) (result ListCertificateEmail, err error) {
1113	err = autorest.Respond(
1114		resp,
1115		azure.WithErrorUnlessStatusCode(http.StatusOK),
1116		autorest.ByUnmarshallingJSON(&result.Value),
1117		autorest.ByClosing())
1118	result.Response = autorest.Response{Response: resp}
1119	return
1120}
1121
1122// UpdateCertificate sends the update certificate request.
1123// Parameters:
1124// resourceGroupName - azure resource group name
1125// certificateOrderName - certificate name
1126// name - certificate name
1127// keyVaultCertificate - key Vault secret csm Id
1128func (client CertificateOrdersClient) UpdateCertificate(ctx context.Context, resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate CertificateOrderCertificate) (result CertificateOrderCertificate, err error) {
1129	if tracing.IsEnabled() {
1130		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.UpdateCertificate")
1131		defer func() {
1132			sc := -1
1133			if result.Response.Response != nil {
1134				sc = result.Response.Response.StatusCode
1135			}
1136			tracing.EndSpan(ctx, sc, err)
1137		}()
1138	}
1139	req, err := client.UpdateCertificatePreparer(ctx, resourceGroupName, certificateOrderName, name, keyVaultCertificate)
1140	if err != nil {
1141		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "UpdateCertificate", nil, "Failure preparing request")
1142		return
1143	}
1144
1145	resp, err := client.UpdateCertificateSender(req)
1146	if err != nil {
1147		result.Response = autorest.Response{Response: resp}
1148		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "UpdateCertificate", resp, "Failure sending request")
1149		return
1150	}
1151
1152	result, err = client.UpdateCertificateResponder(resp)
1153	if err != nil {
1154		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "UpdateCertificate", resp, "Failure responding to request")
1155		return
1156	}
1157
1158	return
1159}
1160
1161// UpdateCertificatePreparer prepares the UpdateCertificate request.
1162func (client CertificateOrdersClient) UpdateCertificatePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate CertificateOrderCertificate) (*http.Request, error) {
1163	pathParameters := map[string]interface{}{
1164		"certificateOrderName": autorest.Encode("path", certificateOrderName),
1165		"name":                 autorest.Encode("path", name),
1166		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
1167		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
1168	}
1169
1170	const APIVersion = "2015-08-01"
1171	queryParameters := map[string]interface{}{
1172		"api-version": APIVersion,
1173	}
1174
1175	preparer := autorest.CreatePreparer(
1176		autorest.AsContentType("application/json; charset=utf-8"),
1177		autorest.AsPatch(),
1178		autorest.WithBaseURL(client.BaseURI),
1179		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters),
1180		autorest.WithJSON(keyVaultCertificate),
1181		autorest.WithQueryParameters(queryParameters))
1182	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1183}
1184
1185// UpdateCertificateSender sends the UpdateCertificate request. The method will close the
1186// http.Response Body if it receives an error.
1187func (client CertificateOrdersClient) UpdateCertificateSender(req *http.Request) (*http.Response, error) {
1188	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1189}
1190
1191// UpdateCertificateResponder handles the response to the UpdateCertificate request. The method always
1192// closes the http.Response Body.
1193func (client CertificateOrdersClient) UpdateCertificateResponder(resp *http.Response) (result CertificateOrderCertificate, err error) {
1194	err = autorest.Respond(
1195		resp,
1196		azure.WithErrorUnlessStatusCode(http.StatusOK),
1197		autorest.ByUnmarshallingJSON(&result),
1198		autorest.ByClosing())
1199	result.Response = autorest.Response{Response: resp}
1200	return
1201}
1202
1203// UpdateCertificateOrder sends the update certificate order request.
1204// Parameters:
1205// resourceGroupName - azure resource group name
1206// name - certificate name
1207// certificateDistinguishedName - distinguished name to be used for purchasing certificate
1208func (client CertificateOrdersClient) UpdateCertificateOrder(ctx context.Context, resourceGroupName string, name string, certificateDistinguishedName CertificateOrder) (result CertificateOrder, err error) {
1209	if tracing.IsEnabled() {
1210		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.UpdateCertificateOrder")
1211		defer func() {
1212			sc := -1
1213			if result.Response.Response != nil {
1214				sc = result.Response.Response.StatusCode
1215			}
1216			tracing.EndSpan(ctx, sc, err)
1217		}()
1218	}
1219	req, err := client.UpdateCertificateOrderPreparer(ctx, resourceGroupName, name, certificateDistinguishedName)
1220	if err != nil {
1221		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "UpdateCertificateOrder", nil, "Failure preparing request")
1222		return
1223	}
1224
1225	resp, err := client.UpdateCertificateOrderSender(req)
1226	if err != nil {
1227		result.Response = autorest.Response{Response: resp}
1228		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "UpdateCertificateOrder", resp, "Failure sending request")
1229		return
1230	}
1231
1232	result, err = client.UpdateCertificateOrderResponder(resp)
1233	if err != nil {
1234		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "UpdateCertificateOrder", resp, "Failure responding to request")
1235		return
1236	}
1237
1238	return
1239}
1240
1241// UpdateCertificateOrderPreparer prepares the UpdateCertificateOrder request.
1242func (client CertificateOrdersClient) UpdateCertificateOrderPreparer(ctx context.Context, resourceGroupName string, name string, certificateDistinguishedName CertificateOrder) (*http.Request, error) {
1243	pathParameters := map[string]interface{}{
1244		"name":              autorest.Encode("path", name),
1245		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1246		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1247	}
1248
1249	const APIVersion = "2015-08-01"
1250	queryParameters := map[string]interface{}{
1251		"api-version": APIVersion,
1252	}
1253
1254	preparer := autorest.CreatePreparer(
1255		autorest.AsContentType("application/json; charset=utf-8"),
1256		autorest.AsPatch(),
1257		autorest.WithBaseURL(client.BaseURI),
1258		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}", pathParameters),
1259		autorest.WithJSON(certificateDistinguishedName),
1260		autorest.WithQueryParameters(queryParameters))
1261	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1262}
1263
1264// UpdateCertificateOrderSender sends the UpdateCertificateOrder request. The method will close the
1265// http.Response Body if it receives an error.
1266func (client CertificateOrdersClient) UpdateCertificateOrderSender(req *http.Request) (*http.Response, error) {
1267	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1268}
1269
1270// UpdateCertificateOrderResponder handles the response to the UpdateCertificateOrder request. The method always
1271// closes the http.Response Body.
1272func (client CertificateOrdersClient) UpdateCertificateOrderResponder(resp *http.Response) (result CertificateOrder, err error) {
1273	err = autorest.Respond(
1274		resp,
1275		azure.WithErrorUnlessStatusCode(http.StatusOK),
1276		autorest.ByUnmarshallingJSON(&result),
1277		autorest.ByClosing())
1278	result.Response = autorest.Response{Response: resp}
1279	return
1280}
1281
1282// VerifyDomainOwnership sends the verify domain ownership request.
1283// Parameters:
1284// resourceGroupName - azure resource group name
1285// name - certificate order name
1286func (client CertificateOrdersClient) VerifyDomainOwnership(ctx context.Context, resourceGroupName string, name string) (result SetObject, err error) {
1287	if tracing.IsEnabled() {
1288		ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersClient.VerifyDomainOwnership")
1289		defer func() {
1290			sc := -1
1291			if result.Response.Response != nil {
1292				sc = result.Response.Response.StatusCode
1293			}
1294			tracing.EndSpan(ctx, sc, err)
1295		}()
1296	}
1297	req, err := client.VerifyDomainOwnershipPreparer(ctx, resourceGroupName, name)
1298	if err != nil {
1299		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "VerifyDomainOwnership", nil, "Failure preparing request")
1300		return
1301	}
1302
1303	resp, err := client.VerifyDomainOwnershipSender(req)
1304	if err != nil {
1305		result.Response = autorest.Response{Response: resp}
1306		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "VerifyDomainOwnership", resp, "Failure sending request")
1307		return
1308	}
1309
1310	result, err = client.VerifyDomainOwnershipResponder(resp)
1311	if err != nil {
1312		err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "VerifyDomainOwnership", resp, "Failure responding to request")
1313		return
1314	}
1315
1316	return
1317}
1318
1319// VerifyDomainOwnershipPreparer prepares the VerifyDomainOwnership request.
1320func (client CertificateOrdersClient) VerifyDomainOwnershipPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) {
1321	pathParameters := map[string]interface{}{
1322		"name":              autorest.Encode("path", name),
1323		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1324		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1325	}
1326
1327	const APIVersion = "2015-08-01"
1328	queryParameters := map[string]interface{}{
1329		"api-version": APIVersion,
1330	}
1331
1332	preparer := autorest.CreatePreparer(
1333		autorest.AsPost(),
1334		autorest.WithBaseURL(client.BaseURI),
1335		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/verifyDomainOwnership", pathParameters),
1336		autorest.WithQueryParameters(queryParameters))
1337	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1338}
1339
1340// VerifyDomainOwnershipSender sends the VerifyDomainOwnership request. The method will close the
1341// http.Response Body if it receives an error.
1342func (client CertificateOrdersClient) VerifyDomainOwnershipSender(req *http.Request) (*http.Response, error) {
1343	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1344}
1345
1346// VerifyDomainOwnershipResponder handles the response to the VerifyDomainOwnership request. The method always
1347// closes the http.Response Body.
1348func (client CertificateOrdersClient) VerifyDomainOwnershipResponder(resp *http.Response) (result SetObject, err error) {
1349	err = autorest.Respond(
1350		resp,
1351		azure.WithErrorUnlessStatusCode(http.StatusOK),
1352		autorest.ByUnmarshallingJSON(&result.Value),
1353		autorest.ByClosing())
1354	result.Response = autorest.Response{Response: resp}
1355	return
1356}
1357