1package sql 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/autorest/validation" 25 "net/http" 26) 27 28// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 29// FailoverGroupsClient is the the Azure SQL Database management API provides a RESTful set of web services that 30// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, 31// and delete databases. 32type FailoverGroupsClient struct { 33 BaseClient 34} 35 36// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 37// NewFailoverGroupsClient creates an instance of the FailoverGroupsClient client. 38func NewFailoverGroupsClient(subscriptionID string) FailoverGroupsClient { 39 return NewFailoverGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) 40} 41 42// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 43// NewFailoverGroupsClientWithBaseURI creates an instance of the FailoverGroupsClient client. 44func NewFailoverGroupsClientWithBaseURI(baseURI string, subscriptionID string) FailoverGroupsClient { 45 return FailoverGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} 46} 47 48// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 49// CreateOrUpdate creates or updates a failover group. 50// 51// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from 52// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover 53// group. failoverGroupName is the name of the failover group. parameters is the failover group parameters. 54func (client FailoverGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroup) (result FailoverGroupsCreateOrUpdateFuture, err error) { 55 if err := validation.Validate([]validation.Validation{ 56 {TargetValue: parameters, 57 Constraints: []validation.Constraint{{Target: "parameters.FailoverGroupProperties", Name: validation.Null, Rule: false, 58 Chain: []validation.Constraint{{Target: "parameters.FailoverGroupProperties.ReadWriteEndpoint", Name: validation.Null, Rule: true, Chain: nil}, 59 {Target: "parameters.FailoverGroupProperties.PartnerServers", Name: validation.Null, Rule: true, Chain: nil}, 60 }}}}}); err != nil { 61 return result, validation.NewError("sql.FailoverGroupsClient", "CreateOrUpdate", err.Error()) 62 } 63 64 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, failoverGroupName, parameters) 65 if err != nil { 66 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") 67 return 68 } 69 70 result, err = client.CreateOrUpdateSender(req) 71 if err != nil { 72 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") 73 return 74 } 75 76 return 77} 78 79// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 80// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 81func (client FailoverGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroup) (*http.Request, error) { 82 pathParameters := map[string]interface{}{ 83 "failoverGroupName": autorest.Encode("path", failoverGroupName), 84 "resourceGroupName": autorest.Encode("path", resourceGroupName), 85 "serverName": autorest.Encode("path", serverName), 86 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 87 } 88 89 const APIVersion = "2015-05-01-preview" 90 queryParameters := map[string]interface{}{ 91 "api-version": APIVersion, 92 } 93 94 preparer := autorest.CreatePreparer( 95 autorest.AsContentType("application/json; charset=utf-8"), 96 autorest.AsPut(), 97 autorest.WithBaseURL(client.BaseURI), 98 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", pathParameters), 99 autorest.WithJSON(parameters), 100 autorest.WithQueryParameters(queryParameters)) 101 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 102} 103 104// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 105// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 106// http.Response Body if it receives an error. 107func (client FailoverGroupsClient) CreateOrUpdateSender(req *http.Request) (future FailoverGroupsCreateOrUpdateFuture, err error) { 108 sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) 109 future.Future = azure.NewFuture(req) 110 future.req = req 111 _, err = future.Done(sender) 112 if err != nil { 113 return 114 } 115 err = autorest.Respond(future.Response(), 116 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) 117 return 118} 119 120// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 121// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 122// closes the http.Response Body. 123func (client FailoverGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result FailoverGroup, err error) { 124 err = autorest.Respond( 125 resp, 126 client.ByInspecting(), 127 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), 128 autorest.ByUnmarshallingJSON(&result), 129 autorest.ByClosing()) 130 result.Response = autorest.Response{Response: resp} 131 return 132} 133 134// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 135// Delete deletes a failover group. 136// 137// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from 138// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover 139// group. failoverGroupName is the name of the failover group. 140func (client FailoverGroupsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroupsDeleteFuture, err error) { 141 req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, failoverGroupName) 142 if err != nil { 143 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Delete", nil, "Failure preparing request") 144 return 145 } 146 147 result, err = client.DeleteSender(req) 148 if err != nil { 149 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Delete", result.Response(), "Failure sending request") 150 return 151 } 152 153 return 154} 155 156// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 157// DeletePreparer prepares the Delete request. 158func (client FailoverGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { 159 pathParameters := map[string]interface{}{ 160 "failoverGroupName": autorest.Encode("path", failoverGroupName), 161 "resourceGroupName": autorest.Encode("path", resourceGroupName), 162 "serverName": autorest.Encode("path", serverName), 163 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 164 } 165 166 const APIVersion = "2015-05-01-preview" 167 queryParameters := map[string]interface{}{ 168 "api-version": APIVersion, 169 } 170 171 preparer := autorest.CreatePreparer( 172 autorest.AsDelete(), 173 autorest.WithBaseURL(client.BaseURI), 174 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", pathParameters), 175 autorest.WithQueryParameters(queryParameters)) 176 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 177} 178 179// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 180// DeleteSender sends the Delete request. The method will close the 181// http.Response Body if it receives an error. 182func (client FailoverGroupsClient) DeleteSender(req *http.Request) (future FailoverGroupsDeleteFuture, err error) { 183 sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) 184 future.Future = azure.NewFuture(req) 185 future.req = req 186 _, err = future.Done(sender) 187 if err != nil { 188 return 189 } 190 err = autorest.Respond(future.Response(), 191 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) 192 return 193} 194 195// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 196// DeleteResponder handles the response to the Delete request. The method always 197// closes the http.Response Body. 198func (client FailoverGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 199 err = autorest.Respond( 200 resp, 201 client.ByInspecting(), 202 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 203 autorest.ByClosing()) 204 result.Response = resp 205 return 206} 207 208// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 209// Failover fails over from the current primary server to this server. 210// 211// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from 212// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover 213// group. failoverGroupName is the name of the failover group. 214func (client FailoverGroupsClient) Failover(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroupsFailoverFuture, err error) { 215 req, err := client.FailoverPreparer(ctx, resourceGroupName, serverName, failoverGroupName) 216 if err != nil { 217 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Failover", nil, "Failure preparing request") 218 return 219 } 220 221 result, err = client.FailoverSender(req) 222 if err != nil { 223 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Failover", result.Response(), "Failure sending request") 224 return 225 } 226 227 return 228} 229 230// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 231// FailoverPreparer prepares the Failover request. 232func (client FailoverGroupsClient) FailoverPreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { 233 pathParameters := map[string]interface{}{ 234 "failoverGroupName": autorest.Encode("path", failoverGroupName), 235 "resourceGroupName": autorest.Encode("path", resourceGroupName), 236 "serverName": autorest.Encode("path", serverName), 237 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 238 } 239 240 const APIVersion = "2015-05-01-preview" 241 queryParameters := map[string]interface{}{ 242 "api-version": APIVersion, 243 } 244 245 preparer := autorest.CreatePreparer( 246 autorest.AsPost(), 247 autorest.WithBaseURL(client.BaseURI), 248 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/failover", pathParameters), 249 autorest.WithQueryParameters(queryParameters)) 250 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 251} 252 253// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 254// FailoverSender sends the Failover request. The method will close the 255// http.Response Body if it receives an error. 256func (client FailoverGroupsClient) FailoverSender(req *http.Request) (future FailoverGroupsFailoverFuture, err error) { 257 sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) 258 future.Future = azure.NewFuture(req) 259 future.req = req 260 _, err = future.Done(sender) 261 if err != nil { 262 return 263 } 264 err = autorest.Respond(future.Response(), 265 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) 266 return 267} 268 269// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 270// FailoverResponder handles the response to the Failover request. The method always 271// closes the http.Response Body. 272func (client FailoverGroupsClient) FailoverResponder(resp *http.Response) (result FailoverGroup, err error) { 273 err = autorest.Respond( 274 resp, 275 client.ByInspecting(), 276 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 277 autorest.ByUnmarshallingJSON(&result), 278 autorest.ByClosing()) 279 result.Response = autorest.Response{Response: resp} 280 return 281} 282 283// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 284// ForceFailoverAllowDataLoss fails over from the current primary server to this server. This operation might result in 285// data loss. 286// 287// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from 288// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover 289// group. failoverGroupName is the name of the failover group. 290func (client FailoverGroupsClient) ForceFailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroupsForceFailoverAllowDataLossFuture, err error) { 291 req, err := client.ForceFailoverAllowDataLossPreparer(ctx, resourceGroupName, serverName, failoverGroupName) 292 if err != nil { 293 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ForceFailoverAllowDataLoss", nil, "Failure preparing request") 294 return 295 } 296 297 result, err = client.ForceFailoverAllowDataLossSender(req) 298 if err != nil { 299 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ForceFailoverAllowDataLoss", result.Response(), "Failure sending request") 300 return 301 } 302 303 return 304} 305 306// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 307// ForceFailoverAllowDataLossPreparer prepares the ForceFailoverAllowDataLoss request. 308func (client FailoverGroupsClient) ForceFailoverAllowDataLossPreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { 309 pathParameters := map[string]interface{}{ 310 "failoverGroupName": autorest.Encode("path", failoverGroupName), 311 "resourceGroupName": autorest.Encode("path", resourceGroupName), 312 "serverName": autorest.Encode("path", serverName), 313 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 314 } 315 316 const APIVersion = "2015-05-01-preview" 317 queryParameters := map[string]interface{}{ 318 "api-version": APIVersion, 319 } 320 321 preparer := autorest.CreatePreparer( 322 autorest.AsPost(), 323 autorest.WithBaseURL(client.BaseURI), 324 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss", pathParameters), 325 autorest.WithQueryParameters(queryParameters)) 326 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 327} 328 329// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 330// ForceFailoverAllowDataLossSender sends the ForceFailoverAllowDataLoss request. The method will close the 331// http.Response Body if it receives an error. 332func (client FailoverGroupsClient) ForceFailoverAllowDataLossSender(req *http.Request) (future FailoverGroupsForceFailoverAllowDataLossFuture, err error) { 333 sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) 334 future.Future = azure.NewFuture(req) 335 future.req = req 336 _, err = future.Done(sender) 337 if err != nil { 338 return 339 } 340 err = autorest.Respond(future.Response(), 341 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) 342 return 343} 344 345// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 346// ForceFailoverAllowDataLossResponder handles the response to the ForceFailoverAllowDataLoss request. The method always 347// closes the http.Response Body. 348func (client FailoverGroupsClient) ForceFailoverAllowDataLossResponder(resp *http.Response) (result FailoverGroup, err error) { 349 err = autorest.Respond( 350 resp, 351 client.ByInspecting(), 352 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 353 autorest.ByUnmarshallingJSON(&result), 354 autorest.ByClosing()) 355 result.Response = autorest.Response{Response: resp} 356 return 357} 358 359// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 360// Get gets a failover group. 361// 362// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from 363// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover 364// group. failoverGroupName is the name of the failover group. 365func (client FailoverGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroup, err error) { 366 req, err := client.GetPreparer(ctx, resourceGroupName, serverName, failoverGroupName) 367 if err != nil { 368 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Get", nil, "Failure preparing request") 369 return 370 } 371 372 resp, err := client.GetSender(req) 373 if err != nil { 374 result.Response = autorest.Response{Response: resp} 375 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Get", resp, "Failure sending request") 376 return 377 } 378 379 result, err = client.GetResponder(resp) 380 if err != nil { 381 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Get", resp, "Failure responding to request") 382 } 383 384 return 385} 386 387// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 388// GetPreparer prepares the Get request. 389func (client FailoverGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { 390 pathParameters := map[string]interface{}{ 391 "failoverGroupName": autorest.Encode("path", failoverGroupName), 392 "resourceGroupName": autorest.Encode("path", resourceGroupName), 393 "serverName": autorest.Encode("path", serverName), 394 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 395 } 396 397 const APIVersion = "2015-05-01-preview" 398 queryParameters := map[string]interface{}{ 399 "api-version": APIVersion, 400 } 401 402 preparer := autorest.CreatePreparer( 403 autorest.AsGet(), 404 autorest.WithBaseURL(client.BaseURI), 405 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", pathParameters), 406 autorest.WithQueryParameters(queryParameters)) 407 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 408} 409 410// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 411// GetSender sends the Get request. The method will close the 412// http.Response Body if it receives an error. 413func (client FailoverGroupsClient) GetSender(req *http.Request) (*http.Response, error) { 414 return autorest.SendWithSender(client, req, 415 azure.DoRetryWithRegistration(client.Client)) 416} 417 418// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 419// GetResponder handles the response to the Get request. The method always 420// closes the http.Response Body. 421func (client FailoverGroupsClient) GetResponder(resp *http.Response) (result FailoverGroup, err error) { 422 err = autorest.Respond( 423 resp, 424 client.ByInspecting(), 425 azure.WithErrorUnlessStatusCode(http.StatusOK), 426 autorest.ByUnmarshallingJSON(&result), 427 autorest.ByClosing()) 428 result.Response = autorest.Response{Response: resp} 429 return 430} 431 432// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 433// ListByServer lists the failover groups in a server. 434// 435// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from 436// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover 437// group. 438func (client FailoverGroupsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result FailoverGroupListResultPage, err error) { 439 result.fn = client.listByServerNextResults 440 req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) 441 if err != nil { 442 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ListByServer", nil, "Failure preparing request") 443 return 444 } 445 446 resp, err := client.ListByServerSender(req) 447 if err != nil { 448 result.fglr.Response = autorest.Response{Response: resp} 449 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ListByServer", resp, "Failure sending request") 450 return 451 } 452 453 result.fglr, err = client.ListByServerResponder(resp) 454 if err != nil { 455 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ListByServer", resp, "Failure responding to request") 456 } 457 458 return 459} 460 461// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 462// ListByServerPreparer prepares the ListByServer request. 463func (client FailoverGroupsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { 464 pathParameters := map[string]interface{}{ 465 "resourceGroupName": autorest.Encode("path", resourceGroupName), 466 "serverName": autorest.Encode("path", serverName), 467 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 468 } 469 470 const APIVersion = "2015-05-01-preview" 471 queryParameters := map[string]interface{}{ 472 "api-version": APIVersion, 473 } 474 475 preparer := autorest.CreatePreparer( 476 autorest.AsGet(), 477 autorest.WithBaseURL(client.BaseURI), 478 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups", pathParameters), 479 autorest.WithQueryParameters(queryParameters)) 480 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 481} 482 483// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 484// ListByServerSender sends the ListByServer request. The method will close the 485// http.Response Body if it receives an error. 486func (client FailoverGroupsClient) ListByServerSender(req *http.Request) (*http.Response, error) { 487 return autorest.SendWithSender(client, req, 488 azure.DoRetryWithRegistration(client.Client)) 489} 490 491// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 492// ListByServerResponder handles the response to the ListByServer request. The method always 493// closes the http.Response Body. 494func (client FailoverGroupsClient) ListByServerResponder(resp *http.Response) (result FailoverGroupListResult, err error) { 495 err = autorest.Respond( 496 resp, 497 client.ByInspecting(), 498 azure.WithErrorUnlessStatusCode(http.StatusOK), 499 autorest.ByUnmarshallingJSON(&result), 500 autorest.ByClosing()) 501 result.Response = autorest.Response{Response: resp} 502 return 503} 504 505// listByServerNextResults retrieves the next set of results, if any. 506func (client FailoverGroupsClient) listByServerNextResults(lastResults FailoverGroupListResult) (result FailoverGroupListResult, err error) { 507 req, err := lastResults.failoverGroupListResultPreparer() 508 if err != nil { 509 return result, autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "listByServerNextResults", nil, "Failure preparing next results request") 510 } 511 if req == nil { 512 return 513 } 514 resp, err := client.ListByServerSender(req) 515 if err != nil { 516 result.Response = autorest.Response{Response: resp} 517 return result, autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "listByServerNextResults", resp, "Failure sending next results request") 518 } 519 result, err = client.ListByServerResponder(resp) 520 if err != nil { 521 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "listByServerNextResults", resp, "Failure responding to next results request") 522 } 523 return 524} 525 526// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 527// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. 528func (client FailoverGroupsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result FailoverGroupListResultIterator, err error) { 529 result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) 530 return 531} 532 533// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 534// Update updates a failover group. 535// 536// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from 537// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover 538// group. failoverGroupName is the name of the failover group. parameters is the failover group parameters. 539func (client FailoverGroupsClient) Update(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroupUpdate) (result FailoverGroupsUpdateFuture, err error) { 540 req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, failoverGroupName, parameters) 541 if err != nil { 542 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Update", nil, "Failure preparing request") 543 return 544 } 545 546 result, err = client.UpdateSender(req) 547 if err != nil { 548 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Update", result.Response(), "Failure sending request") 549 return 550 } 551 552 return 553} 554 555// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 556// UpdatePreparer prepares the Update request. 557func (client FailoverGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroupUpdate) (*http.Request, error) { 558 pathParameters := map[string]interface{}{ 559 "failoverGroupName": autorest.Encode("path", failoverGroupName), 560 "resourceGroupName": autorest.Encode("path", resourceGroupName), 561 "serverName": autorest.Encode("path", serverName), 562 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 563 } 564 565 const APIVersion = "2015-05-01-preview" 566 queryParameters := map[string]interface{}{ 567 "api-version": APIVersion, 568 } 569 570 preparer := autorest.CreatePreparer( 571 autorest.AsContentType("application/json; charset=utf-8"), 572 autorest.AsPatch(), 573 autorest.WithBaseURL(client.BaseURI), 574 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", pathParameters), 575 autorest.WithJSON(parameters), 576 autorest.WithQueryParameters(queryParameters)) 577 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 578} 579 580// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 581// UpdateSender sends the Update request. The method will close the 582// http.Response Body if it receives an error. 583func (client FailoverGroupsClient) UpdateSender(req *http.Request) (future FailoverGroupsUpdateFuture, err error) { 584 sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) 585 future.Future = azure.NewFuture(req) 586 future.req = req 587 _, err = future.Done(sender) 588 if err != nil { 589 return 590 } 591 err = autorest.Respond(future.Response(), 592 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) 593 return 594} 595 596// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. 597// UpdateResponder handles the response to the Update request. The method always 598// closes the http.Response Body. 599func (client FailoverGroupsClient) UpdateResponder(resp *http.Response) (result FailoverGroup, err error) { 600 err = autorest.Respond( 601 resp, 602 client.ByInspecting(), 603 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 604 autorest.ByUnmarshallingJSON(&result), 605 autorest.ByClosing()) 606 result.Response = autorest.Response{Response: resp} 607 return 608} 609