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 "net/http" 25) 26 27// CertificateRegistrationProviderClient is the webSite Management Client 28type CertificateRegistrationProviderClient struct { 29 BaseClient 30} 31 32// NewCertificateRegistrationProviderClient creates an instance of the CertificateRegistrationProviderClient client. 33func NewCertificateRegistrationProviderClient(subscriptionID string) CertificateRegistrationProviderClient { 34 return NewCertificateRegistrationProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) 35} 36 37// NewCertificateRegistrationProviderClientWithBaseURI creates an instance of the CertificateRegistrationProviderClient 38// client. 39func NewCertificateRegistrationProviderClientWithBaseURI(baseURI string, subscriptionID string) CertificateRegistrationProviderClient { 40 return CertificateRegistrationProviderClient{NewWithBaseURI(baseURI, subscriptionID)} 41} 42 43// ListOperations implements Csm operations Api to exposes the list of available Csm Apis under the resource provider 44func (client CertificateRegistrationProviderClient) ListOperations(ctx context.Context) (result CsmOperationCollectionPage, err error) { 45 result.fn = client.listOperationsNextResults 46 req, err := client.ListOperationsPreparer(ctx) 47 if err != nil { 48 err = autorest.NewErrorWithError(err, "web.CertificateRegistrationProviderClient", "ListOperations", nil, "Failure preparing request") 49 return 50 } 51 52 resp, err := client.ListOperationsSender(req) 53 if err != nil { 54 result.coc.Response = autorest.Response{Response: resp} 55 err = autorest.NewErrorWithError(err, "web.CertificateRegistrationProviderClient", "ListOperations", resp, "Failure sending request") 56 return 57 } 58 59 result.coc, err = client.ListOperationsResponder(resp) 60 if err != nil { 61 err = autorest.NewErrorWithError(err, "web.CertificateRegistrationProviderClient", "ListOperations", resp, "Failure responding to request") 62 } 63 64 return 65} 66 67// ListOperationsPreparer prepares the ListOperations request. 68func (client CertificateRegistrationProviderClient) ListOperationsPreparer(ctx context.Context) (*http.Request, error) { 69 const APIVersion = "2015-08-01" 70 queryParameters := map[string]interface{}{ 71 "api-version": APIVersion, 72 } 73 74 preparer := autorest.CreatePreparer( 75 autorest.AsGet(), 76 autorest.WithBaseURL(client.BaseURI), 77 autorest.WithPath("/providers/Microsoft.CertificateRegistration/operations"), 78 autorest.WithQueryParameters(queryParameters)) 79 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 80} 81 82// ListOperationsSender sends the ListOperations request. The method will close the 83// http.Response Body if it receives an error. 84func (client CertificateRegistrationProviderClient) ListOperationsSender(req *http.Request) (*http.Response, error) { 85 return autorest.SendWithSender(client, req, 86 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 87} 88 89// ListOperationsResponder handles the response to the ListOperations request. The method always 90// closes the http.Response Body. 91func (client CertificateRegistrationProviderClient) ListOperationsResponder(resp *http.Response) (result CsmOperationCollection, err error) { 92 err = autorest.Respond( 93 resp, 94 client.ByInspecting(), 95 azure.WithErrorUnlessStatusCode(http.StatusOK), 96 autorest.ByUnmarshallingJSON(&result), 97 autorest.ByClosing()) 98 result.Response = autorest.Response{Response: resp} 99 return 100} 101 102// listOperationsNextResults retrieves the next set of results, if any. 103func (client CertificateRegistrationProviderClient) listOperationsNextResults(lastResults CsmOperationCollection) (result CsmOperationCollection, err error) { 104 req, err := lastResults.csmOperationCollectionPreparer() 105 if err != nil { 106 return result, autorest.NewErrorWithError(err, "web.CertificateRegistrationProviderClient", "listOperationsNextResults", nil, "Failure preparing next results request") 107 } 108 if req == nil { 109 return 110 } 111 resp, err := client.ListOperationsSender(req) 112 if err != nil { 113 result.Response = autorest.Response{Response: resp} 114 return result, autorest.NewErrorWithError(err, "web.CertificateRegistrationProviderClient", "listOperationsNextResults", resp, "Failure sending next results request") 115 } 116 result, err = client.ListOperationsResponder(resp) 117 if err != nil { 118 err = autorest.NewErrorWithError(err, "web.CertificateRegistrationProviderClient", "listOperationsNextResults", resp, "Failure responding to next results request") 119 } 120 return 121} 122 123// ListOperationsComplete enumerates all values, automatically crossing page boundaries as required. 124func (client CertificateRegistrationProviderClient) ListOperationsComplete(ctx context.Context) (result CsmOperationCollectionIterator, err error) { 125 result.page, err = client.ListOperations(ctx) 126 return 127} 128