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