1package containerregistry 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 "github.com/Azure/go-autorest/tracing" 26 "net/http" 27) 28 29// ReplicationsClient is the client for the Replications methods of the Containerregistry service. 30type ReplicationsClient struct { 31 BaseClient 32} 33 34// NewReplicationsClient creates an instance of the ReplicationsClient client. 35func NewReplicationsClient(subscriptionID string) ReplicationsClient { 36 return NewReplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) 37} 38 39// NewReplicationsClientWithBaseURI creates an instance of the ReplicationsClient client. 40func NewReplicationsClientWithBaseURI(baseURI string, subscriptionID string) ReplicationsClient { 41 return ReplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} 42} 43 44// Create creates a replication for a container registry with the specified parameters. 45// Parameters: 46// resourceGroupName - the name of the resource group to which the container registry belongs. 47// registryName - the name of the container registry. 48// replicationName - the name of the replication. 49// replication - the parameters for creating a replication. 50func (client ReplicationsClient) Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (result ReplicationsCreateFuture, err error) { 51 if tracing.IsEnabled() { 52 ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.Create") 53 defer func() { 54 sc := -1 55 if result.Response() != nil { 56 sc = result.Response().StatusCode 57 } 58 tracing.EndSpan(ctx, sc, err) 59 }() 60 } 61 if err := validation.Validate([]validation.Validation{ 62 {TargetValue: resourceGroupName, 63 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, 64 {TargetValue: registryName, 65 Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 66 {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, 67 {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, 68 {TargetValue: replicationName, 69 Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 70 {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, 71 {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { 72 return result, validation.NewError("containerregistry.ReplicationsClient", "Create", err.Error()) 73 } 74 75 req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, replicationName, replication) 76 if err != nil { 77 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", nil, "Failure preparing request") 78 return 79 } 80 81 result, err = client.CreateSender(req) 82 if err != nil { 83 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", result.Response(), "Failure sending request") 84 return 85 } 86 87 return 88} 89 90// CreatePreparer prepares the Create request. 91func (client ReplicationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (*http.Request, error) { 92 pathParameters := map[string]interface{}{ 93 "registryName": autorest.Encode("path", registryName), 94 "replicationName": autorest.Encode("path", replicationName), 95 "resourceGroupName": autorest.Encode("path", resourceGroupName), 96 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 97 } 98 99 const APIVersion = "2017-10-01" 100 queryParameters := map[string]interface{}{ 101 "api-version": APIVersion, 102 } 103 104 preparer := autorest.CreatePreparer( 105 autorest.AsContentType("application/json; charset=utf-8"), 106 autorest.AsPut(), 107 autorest.WithBaseURL(client.BaseURI), 108 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), 109 autorest.WithJSON(replication), 110 autorest.WithQueryParameters(queryParameters)) 111 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 112} 113 114// CreateSender sends the Create request. The method will close the 115// http.Response Body if it receives an error. 116func (client ReplicationsClient) CreateSender(req *http.Request) (future ReplicationsCreateFuture, err error) { 117 sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) 118 var resp *http.Response 119 resp, err = autorest.SendWithSender(client, req, sd...) 120 if err != nil { 121 return 122 } 123 future.Future, err = azure.NewFutureFromResponse(resp) 124 return 125} 126 127// CreateResponder handles the response to the Create request. The method always 128// closes the http.Response Body. 129func (client ReplicationsClient) CreateResponder(resp *http.Response) (result Replication, err error) { 130 err = autorest.Respond( 131 resp, 132 client.ByInspecting(), 133 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 134 autorest.ByUnmarshallingJSON(&result), 135 autorest.ByClosing()) 136 result.Response = autorest.Response{Response: resp} 137 return 138} 139 140// Delete deletes a replication from a container registry. 141// Parameters: 142// resourceGroupName - the name of the resource group to which the container registry belongs. 143// registryName - the name of the container registry. 144// replicationName - the name of the replication. 145func (client ReplicationsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result ReplicationsDeleteFuture, err error) { 146 if tracing.IsEnabled() { 147 ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.Delete") 148 defer func() { 149 sc := -1 150 if result.Response() != nil { 151 sc = result.Response().StatusCode 152 } 153 tracing.EndSpan(ctx, sc, err) 154 }() 155 } 156 if err := validation.Validate([]validation.Validation{ 157 {TargetValue: resourceGroupName, 158 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, 159 {TargetValue: registryName, 160 Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 161 {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, 162 {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, 163 {TargetValue: replicationName, 164 Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 165 {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, 166 {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { 167 return result, validation.NewError("containerregistry.ReplicationsClient", "Delete", err.Error()) 168 } 169 170 req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, replicationName) 171 if err != nil { 172 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", nil, "Failure preparing request") 173 return 174 } 175 176 result, err = client.DeleteSender(req) 177 if err != nil { 178 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", result.Response(), "Failure sending request") 179 return 180 } 181 182 return 183} 184 185// DeletePreparer prepares the Delete request. 186func (client ReplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { 187 pathParameters := map[string]interface{}{ 188 "registryName": autorest.Encode("path", registryName), 189 "replicationName": autorest.Encode("path", replicationName), 190 "resourceGroupName": autorest.Encode("path", resourceGroupName), 191 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 192 } 193 194 const APIVersion = "2017-10-01" 195 queryParameters := map[string]interface{}{ 196 "api-version": APIVersion, 197 } 198 199 preparer := autorest.CreatePreparer( 200 autorest.AsDelete(), 201 autorest.WithBaseURL(client.BaseURI), 202 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), 203 autorest.WithQueryParameters(queryParameters)) 204 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 205} 206 207// DeleteSender sends the Delete request. The method will close the 208// http.Response Body if it receives an error. 209func (client ReplicationsClient) DeleteSender(req *http.Request) (future ReplicationsDeleteFuture, err error) { 210 sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) 211 var resp *http.Response 212 resp, err = autorest.SendWithSender(client, req, sd...) 213 if err != nil { 214 return 215 } 216 future.Future, err = azure.NewFutureFromResponse(resp) 217 return 218} 219 220// DeleteResponder handles the response to the Delete request. The method always 221// closes the http.Response Body. 222func (client ReplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 223 err = autorest.Respond( 224 resp, 225 client.ByInspecting(), 226 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 227 autorest.ByClosing()) 228 result.Response = resp 229 return 230} 231 232// Get gets the properties of the specified replication. 233// Parameters: 234// resourceGroupName - the name of the resource group to which the container registry belongs. 235// registryName - the name of the container registry. 236// replicationName - the name of the replication. 237func (client ReplicationsClient) Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result Replication, err error) { 238 if tracing.IsEnabled() { 239 ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.Get") 240 defer func() { 241 sc := -1 242 if result.Response.Response != nil { 243 sc = result.Response.Response.StatusCode 244 } 245 tracing.EndSpan(ctx, sc, err) 246 }() 247 } 248 if err := validation.Validate([]validation.Validation{ 249 {TargetValue: resourceGroupName, 250 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, 251 {TargetValue: registryName, 252 Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 253 {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, 254 {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, 255 {TargetValue: replicationName, 256 Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 257 {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, 258 {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { 259 return result, validation.NewError("containerregistry.ReplicationsClient", "Get", err.Error()) 260 } 261 262 req, err := client.GetPreparer(ctx, resourceGroupName, registryName, replicationName) 263 if err != nil { 264 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", nil, "Failure preparing request") 265 return 266 } 267 268 resp, err := client.GetSender(req) 269 if err != nil { 270 result.Response = autorest.Response{Response: resp} 271 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure sending request") 272 return 273 } 274 275 result, err = client.GetResponder(resp) 276 if err != nil { 277 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure responding to request") 278 } 279 280 return 281} 282 283// GetPreparer prepares the Get request. 284func (client ReplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { 285 pathParameters := map[string]interface{}{ 286 "registryName": autorest.Encode("path", registryName), 287 "replicationName": autorest.Encode("path", replicationName), 288 "resourceGroupName": autorest.Encode("path", resourceGroupName), 289 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 290 } 291 292 const APIVersion = "2017-10-01" 293 queryParameters := map[string]interface{}{ 294 "api-version": APIVersion, 295 } 296 297 preparer := autorest.CreatePreparer( 298 autorest.AsGet(), 299 autorest.WithBaseURL(client.BaseURI), 300 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), 301 autorest.WithQueryParameters(queryParameters)) 302 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 303} 304 305// GetSender sends the Get request. The method will close the 306// http.Response Body if it receives an error. 307func (client ReplicationsClient) GetSender(req *http.Request) (*http.Response, error) { 308 sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) 309 return autorest.SendWithSender(client, req, sd...) 310} 311 312// GetResponder handles the response to the Get request. The method always 313// closes the http.Response Body. 314func (client ReplicationsClient) GetResponder(resp *http.Response) (result Replication, err error) { 315 err = autorest.Respond( 316 resp, 317 client.ByInspecting(), 318 azure.WithErrorUnlessStatusCode(http.StatusOK), 319 autorest.ByUnmarshallingJSON(&result), 320 autorest.ByClosing()) 321 result.Response = autorest.Response{Response: resp} 322 return 323} 324 325// List lists all the replications for the specified container registry. 326// Parameters: 327// resourceGroupName - the name of the resource group to which the container registry belongs. 328// registryName - the name of the container registry. 329func (client ReplicationsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultPage, err error) { 330 if tracing.IsEnabled() { 331 ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.List") 332 defer func() { 333 sc := -1 334 if result.rlr.Response.Response != nil { 335 sc = result.rlr.Response.Response.StatusCode 336 } 337 tracing.EndSpan(ctx, sc, err) 338 }() 339 } 340 if err := validation.Validate([]validation.Validation{ 341 {TargetValue: resourceGroupName, 342 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, 343 {TargetValue: registryName, 344 Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 345 {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, 346 {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { 347 return result, validation.NewError("containerregistry.ReplicationsClient", "List", err.Error()) 348 } 349 350 result.fn = client.listNextResults 351 req, err := client.ListPreparer(ctx, resourceGroupName, registryName) 352 if err != nil { 353 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", nil, "Failure preparing request") 354 return 355 } 356 357 resp, err := client.ListSender(req) 358 if err != nil { 359 result.rlr.Response = autorest.Response{Response: resp} 360 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure sending request") 361 return 362 } 363 364 result.rlr, err = client.ListResponder(resp) 365 if err != nil { 366 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure responding to request") 367 } 368 369 return 370} 371 372// ListPreparer prepares the List request. 373func (client ReplicationsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { 374 pathParameters := map[string]interface{}{ 375 "registryName": autorest.Encode("path", registryName), 376 "resourceGroupName": autorest.Encode("path", resourceGroupName), 377 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 378 } 379 380 const APIVersion = "2017-10-01" 381 queryParameters := map[string]interface{}{ 382 "api-version": APIVersion, 383 } 384 385 preparer := autorest.CreatePreparer( 386 autorest.AsGet(), 387 autorest.WithBaseURL(client.BaseURI), 388 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications", pathParameters), 389 autorest.WithQueryParameters(queryParameters)) 390 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 391} 392 393// ListSender sends the List request. The method will close the 394// http.Response Body if it receives an error. 395func (client ReplicationsClient) ListSender(req *http.Request) (*http.Response, error) { 396 sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) 397 return autorest.SendWithSender(client, req, sd...) 398} 399 400// ListResponder handles the response to the List request. The method always 401// closes the http.Response Body. 402func (client ReplicationsClient) ListResponder(resp *http.Response) (result ReplicationListResult, err error) { 403 err = autorest.Respond( 404 resp, 405 client.ByInspecting(), 406 azure.WithErrorUnlessStatusCode(http.StatusOK), 407 autorest.ByUnmarshallingJSON(&result), 408 autorest.ByClosing()) 409 result.Response = autorest.Response{Response: resp} 410 return 411} 412 413// listNextResults retrieves the next set of results, if any. 414func (client ReplicationsClient) listNextResults(ctx context.Context, lastResults ReplicationListResult) (result ReplicationListResult, err error) { 415 req, err := lastResults.replicationListResultPreparer(ctx) 416 if err != nil { 417 return result, autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "listNextResults", nil, "Failure preparing next results request") 418 } 419 if req == nil { 420 return 421 } 422 resp, err := client.ListSender(req) 423 if err != nil { 424 result.Response = autorest.Response{Response: resp} 425 return result, autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure sending next results request") 426 } 427 result, err = client.ListResponder(resp) 428 if err != nil { 429 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure responding to next results request") 430 } 431 return 432} 433 434// ListComplete enumerates all values, automatically crossing page boundaries as required. 435func (client ReplicationsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultIterator, err error) { 436 if tracing.IsEnabled() { 437 ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.List") 438 defer func() { 439 sc := -1 440 if result.Response().Response.Response != nil { 441 sc = result.page.Response().Response.Response.StatusCode 442 } 443 tracing.EndSpan(ctx, sc, err) 444 }() 445 } 446 result.page, err = client.List(ctx, resourceGroupName, registryName) 447 return 448} 449 450// Update updates a replication for a container registry with the specified parameters. 451// Parameters: 452// resourceGroupName - the name of the resource group to which the container registry belongs. 453// registryName - the name of the container registry. 454// replicationName - the name of the replication. 455// replicationUpdateParameters - the parameters for updating a replication. 456func (client ReplicationsClient) Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (result ReplicationsUpdateFuture, err error) { 457 if tracing.IsEnabled() { 458 ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.Update") 459 defer func() { 460 sc := -1 461 if result.Response() != nil { 462 sc = result.Response().StatusCode 463 } 464 tracing.EndSpan(ctx, sc, err) 465 }() 466 } 467 if err := validation.Validate([]validation.Validation{ 468 {TargetValue: resourceGroupName, 469 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, 470 {TargetValue: registryName, 471 Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 472 {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, 473 {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, 474 {TargetValue: replicationName, 475 Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, 476 {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, 477 {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { 478 return result, validation.NewError("containerregistry.ReplicationsClient", "Update", err.Error()) 479 } 480 481 req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, replicationName, replicationUpdateParameters) 482 if err != nil { 483 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", nil, "Failure preparing request") 484 return 485 } 486 487 result, err = client.UpdateSender(req) 488 if err != nil { 489 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", result.Response(), "Failure sending request") 490 return 491 } 492 493 return 494} 495 496// UpdatePreparer prepares the Update request. 497func (client ReplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (*http.Request, error) { 498 pathParameters := map[string]interface{}{ 499 "registryName": autorest.Encode("path", registryName), 500 "replicationName": autorest.Encode("path", replicationName), 501 "resourceGroupName": autorest.Encode("path", resourceGroupName), 502 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 503 } 504 505 const APIVersion = "2017-10-01" 506 queryParameters := map[string]interface{}{ 507 "api-version": APIVersion, 508 } 509 510 preparer := autorest.CreatePreparer( 511 autorest.AsContentType("application/json; charset=utf-8"), 512 autorest.AsPatch(), 513 autorest.WithBaseURL(client.BaseURI), 514 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), 515 autorest.WithJSON(replicationUpdateParameters), 516 autorest.WithQueryParameters(queryParameters)) 517 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 518} 519 520// UpdateSender sends the Update request. The method will close the 521// http.Response Body if it receives an error. 522func (client ReplicationsClient) UpdateSender(req *http.Request) (future ReplicationsUpdateFuture, err error) { 523 sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) 524 var resp *http.Response 525 resp, err = autorest.SendWithSender(client, req, sd...) 526 if err != nil { 527 return 528 } 529 future.Future, err = azure.NewFutureFromResponse(resp) 530 return 531} 532 533// UpdateResponder handles the response to the Update request. The method always 534// closes the http.Response Body. 535func (client ReplicationsClient) UpdateResponder(resp *http.Response) (result Replication, err error) { 536 err = autorest.Respond( 537 resp, 538 client.ByInspecting(), 539 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 540 autorest.ByUnmarshallingJSON(&result), 541 autorest.ByClosing()) 542 result.Response = autorest.Response{Response: resp} 543 return 544} 545