1package datafactory 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// TriggersClient is the the Azure Data Factory V2 management API provides a RESTful set of web services that interact 29// with Azure Data Factory V2 services. 30type TriggersClient struct { 31 BaseClient 32} 33 34// NewTriggersClient creates an instance of the TriggersClient client. 35func NewTriggersClient(subscriptionID string) TriggersClient { 36 return NewTriggersClientWithBaseURI(DefaultBaseURI, subscriptionID) 37} 38 39// NewTriggersClientWithBaseURI creates an instance of the TriggersClient client. 40func NewTriggersClientWithBaseURI(baseURI string, subscriptionID string) TriggersClient { 41 return TriggersClient{NewWithBaseURI(baseURI, subscriptionID)} 42} 43 44// CreateOrUpdate creates or updates a trigger. 45// Parameters: 46// resourceGroupName - the resource group name. 47// factoryName - the factory name. 48// triggerName - the trigger name. 49// trigger - trigger resource definition. 50// ifMatch - eTag of the trigger entity. Should only be specified for update, for which it should match 51// existing entity or can be * for unconditional update. 52func (client TriggersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, trigger TriggerResource, ifMatch string) (result TriggerResource, err error) { 53 if err := validation.Validate([]validation.Validation{ 54 {TargetValue: resourceGroupName, 55 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 56 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 57 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 58 {TargetValue: factoryName, 59 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 60 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 61 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, 62 {TargetValue: triggerName, 63 Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, 64 {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, 65 {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}, 66 {TargetValue: trigger, 67 Constraints: []validation.Constraint{{Target: "trigger.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 68 return result, validation.NewError("datafactory.TriggersClient", "CreateOrUpdate", err.Error()) 69 } 70 71 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, factoryName, triggerName, trigger, ifMatch) 72 if err != nil { 73 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "CreateOrUpdate", nil, "Failure preparing request") 74 return 75 } 76 77 resp, err := client.CreateOrUpdateSender(req) 78 if err != nil { 79 result.Response = autorest.Response{Response: resp} 80 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "CreateOrUpdate", resp, "Failure sending request") 81 return 82 } 83 84 result, err = client.CreateOrUpdateResponder(resp) 85 if err != nil { 86 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "CreateOrUpdate", resp, "Failure responding to request") 87 } 88 89 return 90} 91 92// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 93func (client TriggersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, trigger TriggerResource, ifMatch string) (*http.Request, error) { 94 pathParameters := map[string]interface{}{ 95 "factoryName": autorest.Encode("path", factoryName), 96 "resourceGroupName": autorest.Encode("path", resourceGroupName), 97 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 98 "triggerName": autorest.Encode("path", triggerName), 99 } 100 101 const APIVersion = "2018-06-01" 102 queryParameters := map[string]interface{}{ 103 "api-version": APIVersion, 104 } 105 106 preparer := autorest.CreatePreparer( 107 autorest.AsContentType("application/json; charset=utf-8"), 108 autorest.AsPut(), 109 autorest.WithBaseURL(client.BaseURI), 110 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}", pathParameters), 111 autorest.WithJSON(trigger), 112 autorest.WithQueryParameters(queryParameters)) 113 if len(ifMatch) > 0 { 114 preparer = autorest.DecoratePreparer(preparer, 115 autorest.WithHeader("If-Match", autorest.String(ifMatch))) 116 } 117 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 118} 119 120// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 121// http.Response Body if it receives an error. 122func (client TriggersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { 123 return autorest.SendWithSender(client, req, 124 azure.DoRetryWithRegistration(client.Client)) 125} 126 127// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 128// closes the http.Response Body. 129func (client TriggersClient) CreateOrUpdateResponder(resp *http.Response) (result TriggerResource, err error) { 130 err = autorest.Respond( 131 resp, 132 client.ByInspecting(), 133 azure.WithErrorUnlessStatusCode(http.StatusOK), 134 autorest.ByUnmarshallingJSON(&result), 135 autorest.ByClosing()) 136 result.Response = autorest.Response{Response: resp} 137 return 138} 139 140// Delete deletes a trigger. 141// Parameters: 142// resourceGroupName - the resource group name. 143// factoryName - the factory name. 144// triggerName - the trigger name. 145func (client TriggersClient) Delete(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (result autorest.Response, err error) { 146 if err := validation.Validate([]validation.Validation{ 147 {TargetValue: resourceGroupName, 148 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 149 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 150 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 151 {TargetValue: factoryName, 152 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 153 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 154 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, 155 {TargetValue: triggerName, 156 Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, 157 {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, 158 {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { 159 return result, validation.NewError("datafactory.TriggersClient", "Delete", err.Error()) 160 } 161 162 req, err := client.DeletePreparer(ctx, resourceGroupName, factoryName, triggerName) 163 if err != nil { 164 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Delete", nil, "Failure preparing request") 165 return 166 } 167 168 resp, err := client.DeleteSender(req) 169 if err != nil { 170 result.Response = resp 171 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Delete", resp, "Failure sending request") 172 return 173 } 174 175 result, err = client.DeleteResponder(resp) 176 if err != nil { 177 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Delete", resp, "Failure responding to request") 178 } 179 180 return 181} 182 183// DeletePreparer prepares the Delete request. 184func (client TriggersClient) DeletePreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (*http.Request, error) { 185 pathParameters := map[string]interface{}{ 186 "factoryName": autorest.Encode("path", factoryName), 187 "resourceGroupName": autorest.Encode("path", resourceGroupName), 188 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 189 "triggerName": autorest.Encode("path", triggerName), 190 } 191 192 const APIVersion = "2018-06-01" 193 queryParameters := map[string]interface{}{ 194 "api-version": APIVersion, 195 } 196 197 preparer := autorest.CreatePreparer( 198 autorest.AsDelete(), 199 autorest.WithBaseURL(client.BaseURI), 200 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}", pathParameters), 201 autorest.WithQueryParameters(queryParameters)) 202 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 203} 204 205// DeleteSender sends the Delete request. The method will close the 206// http.Response Body if it receives an error. 207func (client TriggersClient) DeleteSender(req *http.Request) (*http.Response, error) { 208 return autorest.SendWithSender(client, req, 209 azure.DoRetryWithRegistration(client.Client)) 210} 211 212// DeleteResponder handles the response to the Delete request. The method always 213// closes the http.Response Body. 214func (client TriggersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 215 err = autorest.Respond( 216 resp, 217 client.ByInspecting(), 218 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 219 autorest.ByClosing()) 220 result.Response = resp 221 return 222} 223 224// Get gets a trigger. 225// Parameters: 226// resourceGroupName - the resource group name. 227// factoryName - the factory name. 228// triggerName - the trigger name. 229// ifNoneMatch - eTag of the trigger entity. Should only be specified for get. If the ETag matches the existing 230// entity tag, or if * was provided, then no content will be returned. 231func (client TriggersClient) Get(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, ifNoneMatch string) (result TriggerResource, err error) { 232 if err := validation.Validate([]validation.Validation{ 233 {TargetValue: resourceGroupName, 234 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 235 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 236 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 237 {TargetValue: factoryName, 238 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 239 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 240 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, 241 {TargetValue: triggerName, 242 Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, 243 {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, 244 {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { 245 return result, validation.NewError("datafactory.TriggersClient", "Get", err.Error()) 246 } 247 248 req, err := client.GetPreparer(ctx, resourceGroupName, factoryName, triggerName, ifNoneMatch) 249 if err != nil { 250 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Get", nil, "Failure preparing request") 251 return 252 } 253 254 resp, err := client.GetSender(req) 255 if err != nil { 256 result.Response = autorest.Response{Response: resp} 257 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Get", resp, "Failure sending request") 258 return 259 } 260 261 result, err = client.GetResponder(resp) 262 if err != nil { 263 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Get", resp, "Failure responding to request") 264 } 265 266 return 267} 268 269// GetPreparer prepares the Get request. 270func (client TriggersClient) GetPreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, ifNoneMatch string) (*http.Request, error) { 271 pathParameters := map[string]interface{}{ 272 "factoryName": autorest.Encode("path", factoryName), 273 "resourceGroupName": autorest.Encode("path", resourceGroupName), 274 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 275 "triggerName": autorest.Encode("path", triggerName), 276 } 277 278 const APIVersion = "2018-06-01" 279 queryParameters := map[string]interface{}{ 280 "api-version": APIVersion, 281 } 282 283 preparer := autorest.CreatePreparer( 284 autorest.AsGet(), 285 autorest.WithBaseURL(client.BaseURI), 286 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}", pathParameters), 287 autorest.WithQueryParameters(queryParameters)) 288 if len(ifNoneMatch) > 0 { 289 preparer = autorest.DecoratePreparer(preparer, 290 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) 291 } 292 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 293} 294 295// GetSender sends the Get request. The method will close the 296// http.Response Body if it receives an error. 297func (client TriggersClient) GetSender(req *http.Request) (*http.Response, error) { 298 return autorest.SendWithSender(client, req, 299 azure.DoRetryWithRegistration(client.Client)) 300} 301 302// GetResponder handles the response to the Get request. The method always 303// closes the http.Response Body. 304func (client TriggersClient) GetResponder(resp *http.Response) (result TriggerResource, err error) { 305 err = autorest.Respond( 306 resp, 307 client.ByInspecting(), 308 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotModified), 309 autorest.ByUnmarshallingJSON(&result), 310 autorest.ByClosing()) 311 result.Response = autorest.Response{Response: resp} 312 return 313} 314 315// ListByFactory lists triggers. 316// Parameters: 317// resourceGroupName - the resource group name. 318// factoryName - the factory name. 319func (client TriggersClient) ListByFactory(ctx context.Context, resourceGroupName string, factoryName string) (result TriggerListResponsePage, err error) { 320 if err := validation.Validate([]validation.Validation{ 321 {TargetValue: resourceGroupName, 322 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 323 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 324 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 325 {TargetValue: factoryName, 326 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 327 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 328 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil { 329 return result, validation.NewError("datafactory.TriggersClient", "ListByFactory", err.Error()) 330 } 331 332 result.fn = client.listByFactoryNextResults 333 req, err := client.ListByFactoryPreparer(ctx, resourceGroupName, factoryName) 334 if err != nil { 335 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "ListByFactory", nil, "Failure preparing request") 336 return 337 } 338 339 resp, err := client.ListByFactorySender(req) 340 if err != nil { 341 result.tlr.Response = autorest.Response{Response: resp} 342 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "ListByFactory", resp, "Failure sending request") 343 return 344 } 345 346 result.tlr, err = client.ListByFactoryResponder(resp) 347 if err != nil { 348 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "ListByFactory", resp, "Failure responding to request") 349 } 350 351 return 352} 353 354// ListByFactoryPreparer prepares the ListByFactory request. 355func (client TriggersClient) ListByFactoryPreparer(ctx context.Context, resourceGroupName string, factoryName string) (*http.Request, error) { 356 pathParameters := map[string]interface{}{ 357 "factoryName": autorest.Encode("path", factoryName), 358 "resourceGroupName": autorest.Encode("path", resourceGroupName), 359 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 360 } 361 362 const APIVersion = "2018-06-01" 363 queryParameters := map[string]interface{}{ 364 "api-version": APIVersion, 365 } 366 367 preparer := autorest.CreatePreparer( 368 autorest.AsGet(), 369 autorest.WithBaseURL(client.BaseURI), 370 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers", pathParameters), 371 autorest.WithQueryParameters(queryParameters)) 372 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 373} 374 375// ListByFactorySender sends the ListByFactory request. The method will close the 376// http.Response Body if it receives an error. 377func (client TriggersClient) ListByFactorySender(req *http.Request) (*http.Response, error) { 378 return autorest.SendWithSender(client, req, 379 azure.DoRetryWithRegistration(client.Client)) 380} 381 382// ListByFactoryResponder handles the response to the ListByFactory request. The method always 383// closes the http.Response Body. 384func (client TriggersClient) ListByFactoryResponder(resp *http.Response) (result TriggerListResponse, err error) { 385 err = autorest.Respond( 386 resp, 387 client.ByInspecting(), 388 azure.WithErrorUnlessStatusCode(http.StatusOK), 389 autorest.ByUnmarshallingJSON(&result), 390 autorest.ByClosing()) 391 result.Response = autorest.Response{Response: resp} 392 return 393} 394 395// listByFactoryNextResults retrieves the next set of results, if any. 396func (client TriggersClient) listByFactoryNextResults(lastResults TriggerListResponse) (result TriggerListResponse, err error) { 397 req, err := lastResults.triggerListResponsePreparer() 398 if err != nil { 399 return result, autorest.NewErrorWithError(err, "datafactory.TriggersClient", "listByFactoryNextResults", nil, "Failure preparing next results request") 400 } 401 if req == nil { 402 return 403 } 404 resp, err := client.ListByFactorySender(req) 405 if err != nil { 406 result.Response = autorest.Response{Response: resp} 407 return result, autorest.NewErrorWithError(err, "datafactory.TriggersClient", "listByFactoryNextResults", resp, "Failure sending next results request") 408 } 409 result, err = client.ListByFactoryResponder(resp) 410 if err != nil { 411 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "listByFactoryNextResults", resp, "Failure responding to next results request") 412 } 413 return 414} 415 416// ListByFactoryComplete enumerates all values, automatically crossing page boundaries as required. 417func (client TriggersClient) ListByFactoryComplete(ctx context.Context, resourceGroupName string, factoryName string) (result TriggerListResponseIterator, err error) { 418 result.page, err = client.ListByFactory(ctx, resourceGroupName, factoryName) 419 return 420} 421 422// Start starts a trigger. 423// Parameters: 424// resourceGroupName - the resource group name. 425// factoryName - the factory name. 426// triggerName - the trigger name. 427func (client TriggersClient) Start(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (result TriggersStartFuture, err error) { 428 if err := validation.Validate([]validation.Validation{ 429 {TargetValue: resourceGroupName, 430 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 431 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 432 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 433 {TargetValue: factoryName, 434 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 435 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 436 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, 437 {TargetValue: triggerName, 438 Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, 439 {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, 440 {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { 441 return result, validation.NewError("datafactory.TriggersClient", "Start", err.Error()) 442 } 443 444 req, err := client.StartPreparer(ctx, resourceGroupName, factoryName, triggerName) 445 if err != nil { 446 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Start", nil, "Failure preparing request") 447 return 448 } 449 450 result, err = client.StartSender(req) 451 if err != nil { 452 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Start", result.Response(), "Failure sending request") 453 return 454 } 455 456 return 457} 458 459// StartPreparer prepares the Start request. 460func (client TriggersClient) StartPreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (*http.Request, error) { 461 pathParameters := map[string]interface{}{ 462 "factoryName": autorest.Encode("path", factoryName), 463 "resourceGroupName": autorest.Encode("path", resourceGroupName), 464 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 465 "triggerName": autorest.Encode("path", triggerName), 466 } 467 468 const APIVersion = "2018-06-01" 469 queryParameters := map[string]interface{}{ 470 "api-version": APIVersion, 471 } 472 473 preparer := autorest.CreatePreparer( 474 autorest.AsPost(), 475 autorest.WithBaseURL(client.BaseURI), 476 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/start", pathParameters), 477 autorest.WithQueryParameters(queryParameters)) 478 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 479} 480 481// StartSender sends the Start request. The method will close the 482// http.Response Body if it receives an error. 483func (client TriggersClient) StartSender(req *http.Request) (future TriggersStartFuture, err error) { 484 var resp *http.Response 485 resp, err = autorest.SendWithSender(client, req, 486 azure.DoRetryWithRegistration(client.Client)) 487 if err != nil { 488 return 489 } 490 err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) 491 if err != nil { 492 return 493 } 494 future.Future, err = azure.NewFutureFromResponse(resp) 495 return 496} 497 498// StartResponder handles the response to the Start request. The method always 499// closes the http.Response Body. 500func (client TriggersClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { 501 err = autorest.Respond( 502 resp, 503 client.ByInspecting(), 504 azure.WithErrorUnlessStatusCode(http.StatusOK), 505 autorest.ByClosing()) 506 result.Response = resp 507 return 508} 509 510// Stop stops a trigger. 511// Parameters: 512// resourceGroupName - the resource group name. 513// factoryName - the factory name. 514// triggerName - the trigger name. 515func (client TriggersClient) Stop(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (result TriggersStopFuture, err error) { 516 if err := validation.Validate([]validation.Validation{ 517 {TargetValue: resourceGroupName, 518 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 519 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 520 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 521 {TargetValue: factoryName, 522 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 523 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 524 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, 525 {TargetValue: triggerName, 526 Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, 527 {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, 528 {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { 529 return result, validation.NewError("datafactory.TriggersClient", "Stop", err.Error()) 530 } 531 532 req, err := client.StopPreparer(ctx, resourceGroupName, factoryName, triggerName) 533 if err != nil { 534 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Stop", nil, "Failure preparing request") 535 return 536 } 537 538 result, err = client.StopSender(req) 539 if err != nil { 540 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Stop", result.Response(), "Failure sending request") 541 return 542 } 543 544 return 545} 546 547// StopPreparer prepares the Stop request. 548func (client TriggersClient) StopPreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (*http.Request, error) { 549 pathParameters := map[string]interface{}{ 550 "factoryName": autorest.Encode("path", factoryName), 551 "resourceGroupName": autorest.Encode("path", resourceGroupName), 552 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 553 "triggerName": autorest.Encode("path", triggerName), 554 } 555 556 const APIVersion = "2018-06-01" 557 queryParameters := map[string]interface{}{ 558 "api-version": APIVersion, 559 } 560 561 preparer := autorest.CreatePreparer( 562 autorest.AsPost(), 563 autorest.WithBaseURL(client.BaseURI), 564 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/stop", pathParameters), 565 autorest.WithQueryParameters(queryParameters)) 566 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 567} 568 569// StopSender sends the Stop request. The method will close the 570// http.Response Body if it receives an error. 571func (client TriggersClient) StopSender(req *http.Request) (future TriggersStopFuture, err error) { 572 var resp *http.Response 573 resp, err = autorest.SendWithSender(client, req, 574 azure.DoRetryWithRegistration(client.Client)) 575 if err != nil { 576 return 577 } 578 err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) 579 if err != nil { 580 return 581 } 582 future.Future, err = azure.NewFutureFromResponse(resp) 583 return 584} 585 586// StopResponder handles the response to the Stop request. The method always 587// closes the http.Response Body. 588func (client TriggersClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { 589 err = autorest.Respond( 590 resp, 591 client.ByInspecting(), 592 azure.WithErrorUnlessStatusCode(http.StatusOK), 593 autorest.ByClosing()) 594 result.Response = resp 595 return 596} 597