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/tracing" 25 "net/http" 26) 27 28// SyncGroupsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact 29// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and 30// delete databases. 31type SyncGroupsClient struct { 32 BaseClient 33} 34 35// NewSyncGroupsClient creates an instance of the SyncGroupsClient client. 36func NewSyncGroupsClient(subscriptionID string) SyncGroupsClient { 37 return NewSyncGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) 38} 39 40// NewSyncGroupsClientWithBaseURI creates an instance of the SyncGroupsClient client using a custom endpoint. Use this 41// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 42func NewSyncGroupsClientWithBaseURI(baseURI string, subscriptionID string) SyncGroupsClient { 43 return SyncGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} 44} 45 46// CancelSync cancels a sync group synchronization. 47// Parameters: 48// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value 49// from the Azure Resource Manager API or the portal. 50// serverName - the name of the server. 51// databaseName - the name of the database on which the sync group is hosted. 52// syncGroupName - the name of the sync group. 53func (client SyncGroupsClient) CancelSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result autorest.Response, err error) { 54 if tracing.IsEnabled() { 55 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.CancelSync") 56 defer func() { 57 sc := -1 58 if result.Response != nil { 59 sc = result.Response.StatusCode 60 } 61 tracing.EndSpan(ctx, sc, err) 62 }() 63 } 64 req, err := client.CancelSyncPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) 65 if err != nil { 66 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CancelSync", nil, "Failure preparing request") 67 return 68 } 69 70 resp, err := client.CancelSyncSender(req) 71 if err != nil { 72 result.Response = resp 73 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CancelSync", resp, "Failure sending request") 74 return 75 } 76 77 result, err = client.CancelSyncResponder(resp) 78 if err != nil { 79 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CancelSync", resp, "Failure responding to request") 80 } 81 82 return 83} 84 85// CancelSyncPreparer prepares the CancelSync request. 86func (client SyncGroupsClient) CancelSyncPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { 87 pathParameters := map[string]interface{}{ 88 "databaseName": autorest.Encode("path", databaseName), 89 "resourceGroupName": autorest.Encode("path", resourceGroupName), 90 "serverName": autorest.Encode("path", serverName), 91 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 92 "syncGroupName": autorest.Encode("path", syncGroupName), 93 } 94 95 const APIVersion = "2015-05-01-preview" 96 queryParameters := map[string]interface{}{ 97 "api-version": APIVersion, 98 } 99 100 preparer := autorest.CreatePreparer( 101 autorest.AsPost(), 102 autorest.WithBaseURL(client.BaseURI), 103 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/cancelSync", pathParameters), 104 autorest.WithQueryParameters(queryParameters)) 105 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 106} 107 108// CancelSyncSender sends the CancelSync request. The method will close the 109// http.Response Body if it receives an error. 110func (client SyncGroupsClient) CancelSyncSender(req *http.Request) (*http.Response, error) { 111 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 112} 113 114// CancelSyncResponder handles the response to the CancelSync request. The method always 115// closes the http.Response Body. 116func (client SyncGroupsClient) CancelSyncResponder(resp *http.Response) (result autorest.Response, err error) { 117 err = autorest.Respond( 118 resp, 119 client.ByInspecting(), 120 azure.WithErrorUnlessStatusCode(http.StatusOK), 121 autorest.ByClosing()) 122 result.Response = resp 123 return 124} 125 126// CreateOrUpdate creates or updates a sync group. 127// Parameters: 128// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value 129// from the Azure Resource Manager API or the portal. 130// serverName - the name of the server. 131// databaseName - the name of the database on which the sync group is hosted. 132// syncGroupName - the name of the sync group. 133// parameters - the requested sync group resource state. 134func (client SyncGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (result SyncGroupsCreateOrUpdateFuture, err error) { 135 if tracing.IsEnabled() { 136 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.CreateOrUpdate") 137 defer func() { 138 sc := -1 139 if result.Response() != nil { 140 sc = result.Response().StatusCode 141 } 142 tracing.EndSpan(ctx, sc, err) 143 }() 144 } 145 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, parameters) 146 if err != nil { 147 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") 148 return 149 } 150 151 result, err = client.CreateOrUpdateSender(req) 152 if err != nil { 153 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") 154 return 155 } 156 157 return 158} 159 160// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 161func (client SyncGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (*http.Request, error) { 162 pathParameters := map[string]interface{}{ 163 "databaseName": autorest.Encode("path", databaseName), 164 "resourceGroupName": autorest.Encode("path", resourceGroupName), 165 "serverName": autorest.Encode("path", serverName), 166 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 167 "syncGroupName": autorest.Encode("path", syncGroupName), 168 } 169 170 const APIVersion = "2015-05-01-preview" 171 queryParameters := map[string]interface{}{ 172 "api-version": APIVersion, 173 } 174 175 preparer := autorest.CreatePreparer( 176 autorest.AsContentType("application/json; charset=utf-8"), 177 autorest.AsPut(), 178 autorest.WithBaseURL(client.BaseURI), 179 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", pathParameters), 180 autorest.WithJSON(parameters), 181 autorest.WithQueryParameters(queryParameters)) 182 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 183} 184 185// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 186// http.Response Body if it receives an error. 187func (client SyncGroupsClient) CreateOrUpdateSender(req *http.Request) (future SyncGroupsCreateOrUpdateFuture, err error) { 188 var resp *http.Response 189 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 190 if err != nil { 191 return 192 } 193 future.Future, err = azure.NewFutureFromResponse(resp) 194 return 195} 196 197// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 198// closes the http.Response Body. 199func (client SyncGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result SyncGroup, err error) { 200 err = autorest.Respond( 201 resp, 202 client.ByInspecting(), 203 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), 204 autorest.ByUnmarshallingJSON(&result), 205 autorest.ByClosing()) 206 result.Response = autorest.Response{Response: resp} 207 return 208} 209 210// Delete deletes a sync group. 211// Parameters: 212// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value 213// from the Azure Resource Manager API or the portal. 214// serverName - the name of the server. 215// databaseName - the name of the database on which the sync group is hosted. 216// syncGroupName - the name of the sync group. 217func (client SyncGroupsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncGroupsDeleteFuture, err error) { 218 if tracing.IsEnabled() { 219 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.Delete") 220 defer func() { 221 sc := -1 222 if result.Response() != nil { 223 sc = result.Response().StatusCode 224 } 225 tracing.EndSpan(ctx, sc, err) 226 }() 227 } 228 req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) 229 if err != nil { 230 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Delete", nil, "Failure preparing request") 231 return 232 } 233 234 result, err = client.DeleteSender(req) 235 if err != nil { 236 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Delete", result.Response(), "Failure sending request") 237 return 238 } 239 240 return 241} 242 243// DeletePreparer prepares the Delete request. 244func (client SyncGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { 245 pathParameters := map[string]interface{}{ 246 "databaseName": autorest.Encode("path", databaseName), 247 "resourceGroupName": autorest.Encode("path", resourceGroupName), 248 "serverName": autorest.Encode("path", serverName), 249 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 250 "syncGroupName": autorest.Encode("path", syncGroupName), 251 } 252 253 const APIVersion = "2015-05-01-preview" 254 queryParameters := map[string]interface{}{ 255 "api-version": APIVersion, 256 } 257 258 preparer := autorest.CreatePreparer( 259 autorest.AsDelete(), 260 autorest.WithBaseURL(client.BaseURI), 261 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", pathParameters), 262 autorest.WithQueryParameters(queryParameters)) 263 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 264} 265 266// DeleteSender sends the Delete request. The method will close the 267// http.Response Body if it receives an error. 268func (client SyncGroupsClient) DeleteSender(req *http.Request) (future SyncGroupsDeleteFuture, err error) { 269 var resp *http.Response 270 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 271 if err != nil { 272 return 273 } 274 future.Future, err = azure.NewFutureFromResponse(resp) 275 return 276} 277 278// DeleteResponder handles the response to the Delete request. The method always 279// closes the http.Response Body. 280func (client SyncGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 281 err = autorest.Respond( 282 resp, 283 client.ByInspecting(), 284 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 285 autorest.ByClosing()) 286 result.Response = resp 287 return 288} 289 290// Get gets a sync group. 291// Parameters: 292// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value 293// from the Azure Resource Manager API or the portal. 294// serverName - the name of the server. 295// databaseName - the name of the database on which the sync group is hosted. 296// syncGroupName - the name of the sync group. 297func (client SyncGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncGroup, err error) { 298 if tracing.IsEnabled() { 299 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.Get") 300 defer func() { 301 sc := -1 302 if result.Response.Response != nil { 303 sc = result.Response.Response.StatusCode 304 } 305 tracing.EndSpan(ctx, sc, err) 306 }() 307 } 308 req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) 309 if err != nil { 310 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Get", nil, "Failure preparing request") 311 return 312 } 313 314 resp, err := client.GetSender(req) 315 if err != nil { 316 result.Response = autorest.Response{Response: resp} 317 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Get", resp, "Failure sending request") 318 return 319 } 320 321 result, err = client.GetResponder(resp) 322 if err != nil { 323 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Get", resp, "Failure responding to request") 324 } 325 326 return 327} 328 329// GetPreparer prepares the Get request. 330func (client SyncGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { 331 pathParameters := map[string]interface{}{ 332 "databaseName": autorest.Encode("path", databaseName), 333 "resourceGroupName": autorest.Encode("path", resourceGroupName), 334 "serverName": autorest.Encode("path", serverName), 335 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 336 "syncGroupName": autorest.Encode("path", syncGroupName), 337 } 338 339 const APIVersion = "2015-05-01-preview" 340 queryParameters := map[string]interface{}{ 341 "api-version": APIVersion, 342 } 343 344 preparer := autorest.CreatePreparer( 345 autorest.AsGet(), 346 autorest.WithBaseURL(client.BaseURI), 347 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", pathParameters), 348 autorest.WithQueryParameters(queryParameters)) 349 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 350} 351 352// GetSender sends the Get request. The method will close the 353// http.Response Body if it receives an error. 354func (client SyncGroupsClient) GetSender(req *http.Request) (*http.Response, error) { 355 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 356} 357 358// GetResponder handles the response to the Get request. The method always 359// closes the http.Response Body. 360func (client SyncGroupsClient) GetResponder(resp *http.Response) (result SyncGroup, err error) { 361 err = autorest.Respond( 362 resp, 363 client.ByInspecting(), 364 azure.WithErrorUnlessStatusCode(http.StatusOK), 365 autorest.ByUnmarshallingJSON(&result), 366 autorest.ByClosing()) 367 result.Response = autorest.Response{Response: resp} 368 return 369} 370 371// ListByDatabase lists sync groups under a hub database. 372// Parameters: 373// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value 374// from the Azure Resource Manager API or the portal. 375// serverName - the name of the server. 376// databaseName - the name of the database on which the sync group is hosted. 377func (client SyncGroupsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result SyncGroupListResultPage, err error) { 378 if tracing.IsEnabled() { 379 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListByDatabase") 380 defer func() { 381 sc := -1 382 if result.sglr.Response.Response != nil { 383 sc = result.sglr.Response.Response.StatusCode 384 } 385 tracing.EndSpan(ctx, sc, err) 386 }() 387 } 388 result.fn = client.listByDatabaseNextResults 389 req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) 390 if err != nil { 391 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListByDatabase", nil, "Failure preparing request") 392 return 393 } 394 395 resp, err := client.ListByDatabaseSender(req) 396 if err != nil { 397 result.sglr.Response = autorest.Response{Response: resp} 398 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListByDatabase", resp, "Failure sending request") 399 return 400 } 401 402 result.sglr, err = client.ListByDatabaseResponder(resp) 403 if err != nil { 404 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListByDatabase", resp, "Failure responding to request") 405 } 406 407 return 408} 409 410// ListByDatabasePreparer prepares the ListByDatabase request. 411func (client SyncGroupsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { 412 pathParameters := map[string]interface{}{ 413 "databaseName": autorest.Encode("path", databaseName), 414 "resourceGroupName": autorest.Encode("path", resourceGroupName), 415 "serverName": autorest.Encode("path", serverName), 416 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 417 } 418 419 const APIVersion = "2015-05-01-preview" 420 queryParameters := map[string]interface{}{ 421 "api-version": APIVersion, 422 } 423 424 preparer := autorest.CreatePreparer( 425 autorest.AsGet(), 426 autorest.WithBaseURL(client.BaseURI), 427 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups", pathParameters), 428 autorest.WithQueryParameters(queryParameters)) 429 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 430} 431 432// ListByDatabaseSender sends the ListByDatabase request. The method will close the 433// http.Response Body if it receives an error. 434func (client SyncGroupsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { 435 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 436} 437 438// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always 439// closes the http.Response Body. 440func (client SyncGroupsClient) ListByDatabaseResponder(resp *http.Response) (result SyncGroupListResult, err error) { 441 err = autorest.Respond( 442 resp, 443 client.ByInspecting(), 444 azure.WithErrorUnlessStatusCode(http.StatusOK), 445 autorest.ByUnmarshallingJSON(&result), 446 autorest.ByClosing()) 447 result.Response = autorest.Response{Response: resp} 448 return 449} 450 451// listByDatabaseNextResults retrieves the next set of results, if any. 452func (client SyncGroupsClient) listByDatabaseNextResults(ctx context.Context, lastResults SyncGroupListResult) (result SyncGroupListResult, err error) { 453 req, err := lastResults.syncGroupListResultPreparer(ctx) 454 if err != nil { 455 return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") 456 } 457 if req == nil { 458 return 459 } 460 resp, err := client.ListByDatabaseSender(req) 461 if err != nil { 462 result.Response = autorest.Response{Response: resp} 463 return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") 464 } 465 result, err = client.ListByDatabaseResponder(resp) 466 if err != nil { 467 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") 468 } 469 return 470} 471 472// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. 473func (client SyncGroupsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result SyncGroupListResultIterator, err error) { 474 if tracing.IsEnabled() { 475 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListByDatabase") 476 defer func() { 477 sc := -1 478 if result.Response().Response.Response != nil { 479 sc = result.page.Response().Response.Response.StatusCode 480 } 481 tracing.EndSpan(ctx, sc, err) 482 }() 483 } 484 result.page, err = client.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) 485 return 486} 487 488// ListHubSchemas gets a collection of hub database schemas. 489// Parameters: 490// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value 491// from the Azure Resource Manager API or the portal. 492// serverName - the name of the server. 493// databaseName - the name of the database on which the sync group is hosted. 494// syncGroupName - the name of the sync group. 495func (client SyncGroupsClient) ListHubSchemas(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncFullSchemaPropertiesListResultPage, err error) { 496 if tracing.IsEnabled() { 497 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListHubSchemas") 498 defer func() { 499 sc := -1 500 if result.sfsplr.Response.Response != nil { 501 sc = result.sfsplr.Response.Response.StatusCode 502 } 503 tracing.EndSpan(ctx, sc, err) 504 }() 505 } 506 result.fn = client.listHubSchemasNextResults 507 req, err := client.ListHubSchemasPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) 508 if err != nil { 509 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListHubSchemas", nil, "Failure preparing request") 510 return 511 } 512 513 resp, err := client.ListHubSchemasSender(req) 514 if err != nil { 515 result.sfsplr.Response = autorest.Response{Response: resp} 516 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListHubSchemas", resp, "Failure sending request") 517 return 518 } 519 520 result.sfsplr, err = client.ListHubSchemasResponder(resp) 521 if err != nil { 522 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListHubSchemas", resp, "Failure responding to request") 523 } 524 525 return 526} 527 528// ListHubSchemasPreparer prepares the ListHubSchemas request. 529func (client SyncGroupsClient) ListHubSchemasPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { 530 pathParameters := map[string]interface{}{ 531 "databaseName": autorest.Encode("path", databaseName), 532 "resourceGroupName": autorest.Encode("path", resourceGroupName), 533 "serverName": autorest.Encode("path", serverName), 534 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 535 "syncGroupName": autorest.Encode("path", syncGroupName), 536 } 537 538 const APIVersion = "2015-05-01-preview" 539 queryParameters := map[string]interface{}{ 540 "api-version": APIVersion, 541 } 542 543 preparer := autorest.CreatePreparer( 544 autorest.AsGet(), 545 autorest.WithBaseURL(client.BaseURI), 546 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/hubSchemas", pathParameters), 547 autorest.WithQueryParameters(queryParameters)) 548 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 549} 550 551// ListHubSchemasSender sends the ListHubSchemas request. The method will close the 552// http.Response Body if it receives an error. 553func (client SyncGroupsClient) ListHubSchemasSender(req *http.Request) (*http.Response, error) { 554 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 555} 556 557// ListHubSchemasResponder handles the response to the ListHubSchemas request. The method always 558// closes the http.Response Body. 559func (client SyncGroupsClient) ListHubSchemasResponder(resp *http.Response) (result SyncFullSchemaPropertiesListResult, err error) { 560 err = autorest.Respond( 561 resp, 562 client.ByInspecting(), 563 azure.WithErrorUnlessStatusCode(http.StatusOK), 564 autorest.ByUnmarshallingJSON(&result), 565 autorest.ByClosing()) 566 result.Response = autorest.Response{Response: resp} 567 return 568} 569 570// listHubSchemasNextResults retrieves the next set of results, if any. 571func (client SyncGroupsClient) listHubSchemasNextResults(ctx context.Context, lastResults SyncFullSchemaPropertiesListResult) (result SyncFullSchemaPropertiesListResult, err error) { 572 req, err := lastResults.syncFullSchemaPropertiesListResultPreparer(ctx) 573 if err != nil { 574 return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listHubSchemasNextResults", nil, "Failure preparing next results request") 575 } 576 if req == nil { 577 return 578 } 579 resp, err := client.ListHubSchemasSender(req) 580 if err != nil { 581 result.Response = autorest.Response{Response: resp} 582 return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listHubSchemasNextResults", resp, "Failure sending next results request") 583 } 584 result, err = client.ListHubSchemasResponder(resp) 585 if err != nil { 586 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listHubSchemasNextResults", resp, "Failure responding to next results request") 587 } 588 return 589} 590 591// ListHubSchemasComplete enumerates all values, automatically crossing page boundaries as required. 592func (client SyncGroupsClient) ListHubSchemasComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncFullSchemaPropertiesListResultIterator, err error) { 593 if tracing.IsEnabled() { 594 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListHubSchemas") 595 defer func() { 596 sc := -1 597 if result.Response().Response.Response != nil { 598 sc = result.page.Response().Response.Response.StatusCode 599 } 600 tracing.EndSpan(ctx, sc, err) 601 }() 602 } 603 result.page, err = client.ListHubSchemas(ctx, resourceGroupName, serverName, databaseName, syncGroupName) 604 return 605} 606 607// ListLogs gets a collection of sync group logs. 608// Parameters: 609// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value 610// from the Azure Resource Manager API or the portal. 611// serverName - the name of the server. 612// databaseName - the name of the database on which the sync group is hosted. 613// syncGroupName - the name of the sync group. 614// startTime - get logs generated after this time. 615// endTime - get logs generated before this time. 616// typeParameter - the types of logs to retrieve. 617// continuationToken - the continuation token for this operation. 618func (client SyncGroupsClient) ListLogs(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result SyncGroupLogListResultPage, err error) { 619 if tracing.IsEnabled() { 620 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListLogs") 621 defer func() { 622 sc := -1 623 if result.sgllr.Response.Response != nil { 624 sc = result.sgllr.Response.Response.StatusCode 625 } 626 tracing.EndSpan(ctx, sc, err) 627 }() 628 } 629 result.fn = client.listLogsNextResults 630 req, err := client.ListLogsPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, typeParameter, continuationToken) 631 if err != nil { 632 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListLogs", nil, "Failure preparing request") 633 return 634 } 635 636 resp, err := client.ListLogsSender(req) 637 if err != nil { 638 result.sgllr.Response = autorest.Response{Response: resp} 639 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListLogs", resp, "Failure sending request") 640 return 641 } 642 643 result.sgllr, err = client.ListLogsResponder(resp) 644 if err != nil { 645 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListLogs", resp, "Failure responding to request") 646 } 647 648 return 649} 650 651// ListLogsPreparer prepares the ListLogs request. 652func (client SyncGroupsClient) ListLogsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (*http.Request, error) { 653 pathParameters := map[string]interface{}{ 654 "databaseName": autorest.Encode("path", databaseName), 655 "resourceGroupName": autorest.Encode("path", resourceGroupName), 656 "serverName": autorest.Encode("path", serverName), 657 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 658 "syncGroupName": autorest.Encode("path", syncGroupName), 659 } 660 661 const APIVersion = "2015-05-01-preview" 662 queryParameters := map[string]interface{}{ 663 "api-version": APIVersion, 664 "endTime": autorest.Encode("query", endTime), 665 "startTime": autorest.Encode("query", startTime), 666 "type": autorest.Encode("query", typeParameter), 667 } 668 if len(continuationToken) > 0 { 669 queryParameters["continuationToken"] = autorest.Encode("query", continuationToken) 670 } 671 672 preparer := autorest.CreatePreparer( 673 autorest.AsGet(), 674 autorest.WithBaseURL(client.BaseURI), 675 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/logs", pathParameters), 676 autorest.WithQueryParameters(queryParameters)) 677 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 678} 679 680// ListLogsSender sends the ListLogs request. The method will close the 681// http.Response Body if it receives an error. 682func (client SyncGroupsClient) ListLogsSender(req *http.Request) (*http.Response, error) { 683 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 684} 685 686// ListLogsResponder handles the response to the ListLogs request. The method always 687// closes the http.Response Body. 688func (client SyncGroupsClient) ListLogsResponder(resp *http.Response) (result SyncGroupLogListResult, err error) { 689 err = autorest.Respond( 690 resp, 691 client.ByInspecting(), 692 azure.WithErrorUnlessStatusCode(http.StatusOK), 693 autorest.ByUnmarshallingJSON(&result), 694 autorest.ByClosing()) 695 result.Response = autorest.Response{Response: resp} 696 return 697} 698 699// listLogsNextResults retrieves the next set of results, if any. 700func (client SyncGroupsClient) listLogsNextResults(ctx context.Context, lastResults SyncGroupLogListResult) (result SyncGroupLogListResult, err error) { 701 req, err := lastResults.syncGroupLogListResultPreparer(ctx) 702 if err != nil { 703 return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listLogsNextResults", nil, "Failure preparing next results request") 704 } 705 if req == nil { 706 return 707 } 708 resp, err := client.ListLogsSender(req) 709 if err != nil { 710 result.Response = autorest.Response{Response: resp} 711 return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listLogsNextResults", resp, "Failure sending next results request") 712 } 713 result, err = client.ListLogsResponder(resp) 714 if err != nil { 715 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listLogsNextResults", resp, "Failure responding to next results request") 716 } 717 return 718} 719 720// ListLogsComplete enumerates all values, automatically crossing page boundaries as required. 721func (client SyncGroupsClient) ListLogsComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result SyncGroupLogListResultIterator, err error) { 722 if tracing.IsEnabled() { 723 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListLogs") 724 defer func() { 725 sc := -1 726 if result.Response().Response.Response != nil { 727 sc = result.page.Response().Response.Response.StatusCode 728 } 729 tracing.EndSpan(ctx, sc, err) 730 }() 731 } 732 result.page, err = client.ListLogs(ctx, resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, typeParameter, continuationToken) 733 return 734} 735 736// ListSyncDatabaseIds gets a collection of sync database ids. 737// Parameters: 738// locationName - the name of the region where the resource is located. 739func (client SyncGroupsClient) ListSyncDatabaseIds(ctx context.Context, locationName string) (result SyncDatabaseIDListResultPage, err error) { 740 if tracing.IsEnabled() { 741 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListSyncDatabaseIds") 742 defer func() { 743 sc := -1 744 if result.sdilr.Response.Response != nil { 745 sc = result.sdilr.Response.Response.StatusCode 746 } 747 tracing.EndSpan(ctx, sc, err) 748 }() 749 } 750 result.fn = client.listSyncDatabaseIdsNextResults 751 req, err := client.ListSyncDatabaseIdsPreparer(ctx, locationName) 752 if err != nil { 753 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListSyncDatabaseIds", nil, "Failure preparing request") 754 return 755 } 756 757 resp, err := client.ListSyncDatabaseIdsSender(req) 758 if err != nil { 759 result.sdilr.Response = autorest.Response{Response: resp} 760 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListSyncDatabaseIds", resp, "Failure sending request") 761 return 762 } 763 764 result.sdilr, err = client.ListSyncDatabaseIdsResponder(resp) 765 if err != nil { 766 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListSyncDatabaseIds", resp, "Failure responding to request") 767 } 768 769 return 770} 771 772// ListSyncDatabaseIdsPreparer prepares the ListSyncDatabaseIds request. 773func (client SyncGroupsClient) ListSyncDatabaseIdsPreparer(ctx context.Context, locationName string) (*http.Request, error) { 774 pathParameters := map[string]interface{}{ 775 "locationName": autorest.Encode("path", locationName), 776 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 777 } 778 779 const APIVersion = "2015-05-01-preview" 780 queryParameters := map[string]interface{}{ 781 "api-version": APIVersion, 782 } 783 784 preparer := autorest.CreatePreparer( 785 autorest.AsGet(), 786 autorest.WithBaseURL(client.BaseURI), 787 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds", pathParameters), 788 autorest.WithQueryParameters(queryParameters)) 789 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 790} 791 792// ListSyncDatabaseIdsSender sends the ListSyncDatabaseIds request. The method will close the 793// http.Response Body if it receives an error. 794func (client SyncGroupsClient) ListSyncDatabaseIdsSender(req *http.Request) (*http.Response, error) { 795 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 796} 797 798// ListSyncDatabaseIdsResponder handles the response to the ListSyncDatabaseIds request. The method always 799// closes the http.Response Body. 800func (client SyncGroupsClient) ListSyncDatabaseIdsResponder(resp *http.Response) (result SyncDatabaseIDListResult, err error) { 801 err = autorest.Respond( 802 resp, 803 client.ByInspecting(), 804 azure.WithErrorUnlessStatusCode(http.StatusOK), 805 autorest.ByUnmarshallingJSON(&result), 806 autorest.ByClosing()) 807 result.Response = autorest.Response{Response: resp} 808 return 809} 810 811// listSyncDatabaseIdsNextResults retrieves the next set of results, if any. 812func (client SyncGroupsClient) listSyncDatabaseIdsNextResults(ctx context.Context, lastResults SyncDatabaseIDListResult) (result SyncDatabaseIDListResult, err error) { 813 req, err := lastResults.syncDatabaseIDListResultPreparer(ctx) 814 if err != nil { 815 return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listSyncDatabaseIdsNextResults", nil, "Failure preparing next results request") 816 } 817 if req == nil { 818 return 819 } 820 resp, err := client.ListSyncDatabaseIdsSender(req) 821 if err != nil { 822 result.Response = autorest.Response{Response: resp} 823 return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listSyncDatabaseIdsNextResults", resp, "Failure sending next results request") 824 } 825 result, err = client.ListSyncDatabaseIdsResponder(resp) 826 if err != nil { 827 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listSyncDatabaseIdsNextResults", resp, "Failure responding to next results request") 828 } 829 return 830} 831 832// ListSyncDatabaseIdsComplete enumerates all values, automatically crossing page boundaries as required. 833func (client SyncGroupsClient) ListSyncDatabaseIdsComplete(ctx context.Context, locationName string) (result SyncDatabaseIDListResultIterator, err error) { 834 if tracing.IsEnabled() { 835 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListSyncDatabaseIds") 836 defer func() { 837 sc := -1 838 if result.Response().Response.Response != nil { 839 sc = result.page.Response().Response.Response.StatusCode 840 } 841 tracing.EndSpan(ctx, sc, err) 842 }() 843 } 844 result.page, err = client.ListSyncDatabaseIds(ctx, locationName) 845 return 846} 847 848// RefreshHubSchema refreshes a hub database schema. 849// Parameters: 850// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value 851// from the Azure Resource Manager API or the portal. 852// serverName - the name of the server. 853// databaseName - the name of the database on which the sync group is hosted. 854// syncGroupName - the name of the sync group. 855func (client SyncGroupsClient) RefreshHubSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncGroupsRefreshHubSchemaFuture, err error) { 856 if tracing.IsEnabled() { 857 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.RefreshHubSchema") 858 defer func() { 859 sc := -1 860 if result.Response() != nil { 861 sc = result.Response().StatusCode 862 } 863 tracing.EndSpan(ctx, sc, err) 864 }() 865 } 866 req, err := client.RefreshHubSchemaPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) 867 if err != nil { 868 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "RefreshHubSchema", nil, "Failure preparing request") 869 return 870 } 871 872 result, err = client.RefreshHubSchemaSender(req) 873 if err != nil { 874 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "RefreshHubSchema", result.Response(), "Failure sending request") 875 return 876 } 877 878 return 879} 880 881// RefreshHubSchemaPreparer prepares the RefreshHubSchema request. 882func (client SyncGroupsClient) RefreshHubSchemaPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { 883 pathParameters := map[string]interface{}{ 884 "databaseName": autorest.Encode("path", databaseName), 885 "resourceGroupName": autorest.Encode("path", resourceGroupName), 886 "serverName": autorest.Encode("path", serverName), 887 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 888 "syncGroupName": autorest.Encode("path", syncGroupName), 889 } 890 891 const APIVersion = "2015-05-01-preview" 892 queryParameters := map[string]interface{}{ 893 "api-version": APIVersion, 894 } 895 896 preparer := autorest.CreatePreparer( 897 autorest.AsPost(), 898 autorest.WithBaseURL(client.BaseURI), 899 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema", pathParameters), 900 autorest.WithQueryParameters(queryParameters)) 901 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 902} 903 904// RefreshHubSchemaSender sends the RefreshHubSchema request. The method will close the 905// http.Response Body if it receives an error. 906func (client SyncGroupsClient) RefreshHubSchemaSender(req *http.Request) (future SyncGroupsRefreshHubSchemaFuture, err error) { 907 var resp *http.Response 908 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 909 if err != nil { 910 return 911 } 912 future.Future, err = azure.NewFutureFromResponse(resp) 913 return 914} 915 916// RefreshHubSchemaResponder handles the response to the RefreshHubSchema request. The method always 917// closes the http.Response Body. 918func (client SyncGroupsClient) RefreshHubSchemaResponder(resp *http.Response) (result autorest.Response, err error) { 919 err = autorest.Respond( 920 resp, 921 client.ByInspecting(), 922 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 923 autorest.ByClosing()) 924 result.Response = resp 925 return 926} 927 928// TriggerSync triggers a sync group synchronization. 929// Parameters: 930// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value 931// from the Azure Resource Manager API or the portal. 932// serverName - the name of the server. 933// databaseName - the name of the database on which the sync group is hosted. 934// syncGroupName - the name of the sync group. 935func (client SyncGroupsClient) TriggerSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result autorest.Response, err error) { 936 if tracing.IsEnabled() { 937 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.TriggerSync") 938 defer func() { 939 sc := -1 940 if result.Response != nil { 941 sc = result.Response.StatusCode 942 } 943 tracing.EndSpan(ctx, sc, err) 944 }() 945 } 946 req, err := client.TriggerSyncPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) 947 if err != nil { 948 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "TriggerSync", nil, "Failure preparing request") 949 return 950 } 951 952 resp, err := client.TriggerSyncSender(req) 953 if err != nil { 954 result.Response = resp 955 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "TriggerSync", resp, "Failure sending request") 956 return 957 } 958 959 result, err = client.TriggerSyncResponder(resp) 960 if err != nil { 961 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "TriggerSync", resp, "Failure responding to request") 962 } 963 964 return 965} 966 967// TriggerSyncPreparer prepares the TriggerSync request. 968func (client SyncGroupsClient) TriggerSyncPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { 969 pathParameters := map[string]interface{}{ 970 "databaseName": autorest.Encode("path", databaseName), 971 "resourceGroupName": autorest.Encode("path", resourceGroupName), 972 "serverName": autorest.Encode("path", serverName), 973 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 974 "syncGroupName": autorest.Encode("path", syncGroupName), 975 } 976 977 const APIVersion = "2015-05-01-preview" 978 queryParameters := map[string]interface{}{ 979 "api-version": APIVersion, 980 } 981 982 preparer := autorest.CreatePreparer( 983 autorest.AsPost(), 984 autorest.WithBaseURL(client.BaseURI), 985 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/triggerSync", pathParameters), 986 autorest.WithQueryParameters(queryParameters)) 987 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 988} 989 990// TriggerSyncSender sends the TriggerSync request. The method will close the 991// http.Response Body if it receives an error. 992func (client SyncGroupsClient) TriggerSyncSender(req *http.Request) (*http.Response, error) { 993 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 994} 995 996// TriggerSyncResponder handles the response to the TriggerSync request. The method always 997// closes the http.Response Body. 998func (client SyncGroupsClient) TriggerSyncResponder(resp *http.Response) (result autorest.Response, err error) { 999 err = autorest.Respond( 1000 resp, 1001 client.ByInspecting(), 1002 azure.WithErrorUnlessStatusCode(http.StatusOK), 1003 autorest.ByClosing()) 1004 result.Response = resp 1005 return 1006} 1007 1008// Update updates a sync group. 1009// Parameters: 1010// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value 1011// from the Azure Resource Manager API or the portal. 1012// serverName - the name of the server. 1013// databaseName - the name of the database on which the sync group is hosted. 1014// syncGroupName - the name of the sync group. 1015// parameters - the requested sync group resource state. 1016func (client SyncGroupsClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (result SyncGroupsUpdateFuture, err error) { 1017 if tracing.IsEnabled() { 1018 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.Update") 1019 defer func() { 1020 sc := -1 1021 if result.Response() != nil { 1022 sc = result.Response().StatusCode 1023 } 1024 tracing.EndSpan(ctx, sc, err) 1025 }() 1026 } 1027 req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, parameters) 1028 if err != nil { 1029 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Update", nil, "Failure preparing request") 1030 return 1031 } 1032 1033 result, err = client.UpdateSender(req) 1034 if err != nil { 1035 err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Update", result.Response(), "Failure sending request") 1036 return 1037 } 1038 1039 return 1040} 1041 1042// UpdatePreparer prepares the Update request. 1043func (client SyncGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (*http.Request, error) { 1044 pathParameters := map[string]interface{}{ 1045 "databaseName": autorest.Encode("path", databaseName), 1046 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1047 "serverName": autorest.Encode("path", serverName), 1048 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1049 "syncGroupName": autorest.Encode("path", syncGroupName), 1050 } 1051 1052 const APIVersion = "2015-05-01-preview" 1053 queryParameters := map[string]interface{}{ 1054 "api-version": APIVersion, 1055 } 1056 1057 preparer := autorest.CreatePreparer( 1058 autorest.AsContentType("application/json; charset=utf-8"), 1059 autorest.AsPatch(), 1060 autorest.WithBaseURL(client.BaseURI), 1061 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", pathParameters), 1062 autorest.WithJSON(parameters), 1063 autorest.WithQueryParameters(queryParameters)) 1064 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1065} 1066 1067// UpdateSender sends the Update request. The method will close the 1068// http.Response Body if it receives an error. 1069func (client SyncGroupsClient) UpdateSender(req *http.Request) (future SyncGroupsUpdateFuture, err error) { 1070 var resp *http.Response 1071 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1072 if err != nil { 1073 return 1074 } 1075 future.Future, err = azure.NewFutureFromResponse(resp) 1076 return 1077} 1078 1079// UpdateResponder handles the response to the Update request. The method always 1080// closes the http.Response Body. 1081func (client SyncGroupsClient) UpdateResponder(resp *http.Response) (result SyncGroup, err error) { 1082 err = autorest.Respond( 1083 resp, 1084 client.ByInspecting(), 1085 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1086 autorest.ByUnmarshallingJSON(&result), 1087 autorest.ByClosing()) 1088 result.Response = autorest.Response{Response: resp} 1089 return 1090} 1091