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