1package datafactory 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "github.com/Azure/go-autorest/autorest" 12 "github.com/Azure/go-autorest/autorest/azure" 13 "github.com/Azure/go-autorest/autorest/validation" 14 "github.com/Azure/go-autorest/tracing" 15 "net/http" 16) 17 18// TriggersClient is the the Azure Data Factory V2 management API provides a RESTful set of web services that interact 19// with Azure Data Factory V2 services. 20type TriggersClient struct { 21 BaseClient 22} 23 24// NewTriggersClient creates an instance of the TriggersClient client. 25func NewTriggersClient(subscriptionID string) TriggersClient { 26 return NewTriggersClientWithBaseURI(DefaultBaseURI, subscriptionID) 27} 28 29// NewTriggersClientWithBaseURI creates an instance of the TriggersClient client using a custom endpoint. Use this 30// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 31func NewTriggersClientWithBaseURI(baseURI string, subscriptionID string) TriggersClient { 32 return TriggersClient{NewWithBaseURI(baseURI, subscriptionID)} 33} 34 35// CreateOrUpdate creates or updates a trigger. 36// Parameters: 37// resourceGroupName - the resource group name. 38// factoryName - the factory name. 39// triggerName - the trigger name. 40// trigger - trigger resource definition. 41// ifMatch - eTag of the trigger entity. Should only be specified for update, for which it should match 42// existing entity or can be * for unconditional update. 43func (client TriggersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, trigger TriggerResource, ifMatch string) (result TriggerResource, err error) { 44 if tracing.IsEnabled() { 45 ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.CreateOrUpdate") 46 defer func() { 47 sc := -1 48 if result.Response.Response != nil { 49 sc = result.Response.Response.StatusCode 50 } 51 tracing.EndSpan(ctx, sc, err) 52 }() 53 } 54 if err := validation.Validate([]validation.Validation{ 55 {TargetValue: resourceGroupName, 56 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 57 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 58 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 59 {TargetValue: factoryName, 60 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 61 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 62 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, 63 {TargetValue: triggerName, 64 Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, 65 {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, 66 {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { 67 return result, validation.NewError("datafactory.TriggersClient", "CreateOrUpdate", err.Error()) 68 } 69 70 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, factoryName, triggerName, trigger, ifMatch) 71 if err != nil { 72 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "CreateOrUpdate", nil, "Failure preparing request") 73 return 74 } 75 76 resp, err := client.CreateOrUpdateSender(req) 77 if err != nil { 78 result.Response = autorest.Response{Response: resp} 79 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "CreateOrUpdate", resp, "Failure sending request") 80 return 81 } 82 83 result, err = client.CreateOrUpdateResponder(resp) 84 if err != nil { 85 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "CreateOrUpdate", resp, "Failure responding to request") 86 return 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 client.Send(req, azure.DoRetryWithRegistration(client.Client)) 124} 125 126// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 127// closes the http.Response Body. 128func (client TriggersClient) CreateOrUpdateResponder(resp *http.Response) (result TriggerResource, err error) { 129 err = autorest.Respond( 130 resp, 131 azure.WithErrorUnlessStatusCode(http.StatusOK), 132 autorest.ByUnmarshallingJSON(&result), 133 autorest.ByClosing()) 134 result.Response = autorest.Response{Response: resp} 135 return 136} 137 138// Delete deletes a trigger. 139// Parameters: 140// resourceGroupName - the resource group name. 141// factoryName - the factory name. 142// triggerName - the trigger name. 143func (client TriggersClient) Delete(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (result autorest.Response, err error) { 144 if tracing.IsEnabled() { 145 ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.Delete") 146 defer func() { 147 sc := -1 148 if result.Response != nil { 149 sc = result.Response.StatusCode 150 } 151 tracing.EndSpan(ctx, sc, err) 152 }() 153 } 154 if err := validation.Validate([]validation.Validation{ 155 {TargetValue: resourceGroupName, 156 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 157 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 158 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 159 {TargetValue: factoryName, 160 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 161 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 162 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, 163 {TargetValue: triggerName, 164 Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, 165 {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, 166 {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { 167 return result, validation.NewError("datafactory.TriggersClient", "Delete", err.Error()) 168 } 169 170 req, err := client.DeletePreparer(ctx, resourceGroupName, factoryName, triggerName) 171 if err != nil { 172 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Delete", nil, "Failure preparing request") 173 return 174 } 175 176 resp, err := client.DeleteSender(req) 177 if err != nil { 178 result.Response = resp 179 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Delete", resp, "Failure sending request") 180 return 181 } 182 183 result, err = client.DeleteResponder(resp) 184 if err != nil { 185 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Delete", resp, "Failure responding to request") 186 return 187 } 188 189 return 190} 191 192// DeletePreparer prepares the Delete request. 193func (client TriggersClient) DeletePreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (*http.Request, error) { 194 pathParameters := map[string]interface{}{ 195 "factoryName": autorest.Encode("path", factoryName), 196 "resourceGroupName": autorest.Encode("path", resourceGroupName), 197 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 198 "triggerName": autorest.Encode("path", triggerName), 199 } 200 201 const APIVersion = "2018-06-01" 202 queryParameters := map[string]interface{}{ 203 "api-version": APIVersion, 204 } 205 206 preparer := autorest.CreatePreparer( 207 autorest.AsDelete(), 208 autorest.WithBaseURL(client.BaseURI), 209 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}", pathParameters), 210 autorest.WithQueryParameters(queryParameters)) 211 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 212} 213 214// DeleteSender sends the Delete request. The method will close the 215// http.Response Body if it receives an error. 216func (client TriggersClient) DeleteSender(req *http.Request) (*http.Response, error) { 217 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 218} 219 220// DeleteResponder handles the response to the Delete request. The method always 221// closes the http.Response Body. 222func (client TriggersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 223 err = autorest.Respond( 224 resp, 225 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 226 autorest.ByClosing()) 227 result.Response = resp 228 return 229} 230 231// Get gets a trigger. 232// Parameters: 233// resourceGroupName - the resource group name. 234// factoryName - the factory name. 235// triggerName - the trigger name. 236// ifNoneMatch - eTag of the trigger entity. Should only be specified for get. If the ETag matches the existing 237// entity tag, or if * was provided, then no content will be returned. 238func (client TriggersClient) Get(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, ifNoneMatch string) (result TriggerResource, err error) { 239 if tracing.IsEnabled() { 240 ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.Get") 241 defer func() { 242 sc := -1 243 if result.Response.Response != nil { 244 sc = result.Response.Response.StatusCode 245 } 246 tracing.EndSpan(ctx, sc, err) 247 }() 248 } 249 if err := validation.Validate([]validation.Validation{ 250 {TargetValue: resourceGroupName, 251 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 252 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 253 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 254 {TargetValue: factoryName, 255 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 256 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 257 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, 258 {TargetValue: triggerName, 259 Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, 260 {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, 261 {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { 262 return result, validation.NewError("datafactory.TriggersClient", "Get", err.Error()) 263 } 264 265 req, err := client.GetPreparer(ctx, resourceGroupName, factoryName, triggerName, ifNoneMatch) 266 if err != nil { 267 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Get", nil, "Failure preparing request") 268 return 269 } 270 271 resp, err := client.GetSender(req) 272 if err != nil { 273 result.Response = autorest.Response{Response: resp} 274 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Get", resp, "Failure sending request") 275 return 276 } 277 278 result, err = client.GetResponder(resp) 279 if err != nil { 280 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Get", resp, "Failure responding to request") 281 return 282 } 283 284 return 285} 286 287// GetPreparer prepares the Get request. 288func (client TriggersClient) GetPreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, ifNoneMatch string) (*http.Request, error) { 289 pathParameters := map[string]interface{}{ 290 "factoryName": autorest.Encode("path", factoryName), 291 "resourceGroupName": autorest.Encode("path", resourceGroupName), 292 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 293 "triggerName": autorest.Encode("path", triggerName), 294 } 295 296 const APIVersion = "2018-06-01" 297 queryParameters := map[string]interface{}{ 298 "api-version": APIVersion, 299 } 300 301 preparer := autorest.CreatePreparer( 302 autorest.AsGet(), 303 autorest.WithBaseURL(client.BaseURI), 304 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}", pathParameters), 305 autorest.WithQueryParameters(queryParameters)) 306 if len(ifNoneMatch) > 0 { 307 preparer = autorest.DecoratePreparer(preparer, 308 autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) 309 } 310 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 311} 312 313// GetSender sends the Get request. The method will close the 314// http.Response Body if it receives an error. 315func (client TriggersClient) GetSender(req *http.Request) (*http.Response, error) { 316 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 317} 318 319// GetResponder handles the response to the Get request. The method always 320// closes the http.Response Body. 321func (client TriggersClient) GetResponder(resp *http.Response) (result TriggerResource, err error) { 322 err = autorest.Respond( 323 resp, 324 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotModified), 325 autorest.ByUnmarshallingJSON(&result), 326 autorest.ByClosing()) 327 result.Response = autorest.Response{Response: resp} 328 return 329} 330 331// GetEventSubscriptionStatus get a trigger's event subscription status. 332// Parameters: 333// resourceGroupName - the resource group name. 334// factoryName - the factory name. 335// triggerName - the trigger name. 336func (client TriggersClient) GetEventSubscriptionStatus(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (result TriggerSubscriptionOperationStatus, err error) { 337 if tracing.IsEnabled() { 338 ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.GetEventSubscriptionStatus") 339 defer func() { 340 sc := -1 341 if result.Response.Response != nil { 342 sc = result.Response.Response.StatusCode 343 } 344 tracing.EndSpan(ctx, sc, err) 345 }() 346 } 347 if err := validation.Validate([]validation.Validation{ 348 {TargetValue: resourceGroupName, 349 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 350 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 351 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 352 {TargetValue: factoryName, 353 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 354 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 355 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, 356 {TargetValue: triggerName, 357 Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, 358 {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, 359 {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { 360 return result, validation.NewError("datafactory.TriggersClient", "GetEventSubscriptionStatus", err.Error()) 361 } 362 363 req, err := client.GetEventSubscriptionStatusPreparer(ctx, resourceGroupName, factoryName, triggerName) 364 if err != nil { 365 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "GetEventSubscriptionStatus", nil, "Failure preparing request") 366 return 367 } 368 369 resp, err := client.GetEventSubscriptionStatusSender(req) 370 if err != nil { 371 result.Response = autorest.Response{Response: resp} 372 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "GetEventSubscriptionStatus", resp, "Failure sending request") 373 return 374 } 375 376 result, err = client.GetEventSubscriptionStatusResponder(resp) 377 if err != nil { 378 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "GetEventSubscriptionStatus", resp, "Failure responding to request") 379 return 380 } 381 382 return 383} 384 385// GetEventSubscriptionStatusPreparer prepares the GetEventSubscriptionStatus request. 386func (client TriggersClient) GetEventSubscriptionStatusPreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (*http.Request, error) { 387 pathParameters := map[string]interface{}{ 388 "factoryName": autorest.Encode("path", factoryName), 389 "resourceGroupName": autorest.Encode("path", resourceGroupName), 390 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 391 "triggerName": autorest.Encode("path", triggerName), 392 } 393 394 const APIVersion = "2018-06-01" 395 queryParameters := map[string]interface{}{ 396 "api-version": APIVersion, 397 } 398 399 preparer := autorest.CreatePreparer( 400 autorest.AsPost(), 401 autorest.WithBaseURL(client.BaseURI), 402 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/getEventSubscriptionStatus", pathParameters), 403 autorest.WithQueryParameters(queryParameters)) 404 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 405} 406 407// GetEventSubscriptionStatusSender sends the GetEventSubscriptionStatus request. The method will close the 408// http.Response Body if it receives an error. 409func (client TriggersClient) GetEventSubscriptionStatusSender(req *http.Request) (*http.Response, error) { 410 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 411} 412 413// GetEventSubscriptionStatusResponder handles the response to the GetEventSubscriptionStatus request. The method always 414// closes the http.Response Body. 415func (client TriggersClient) GetEventSubscriptionStatusResponder(resp *http.Response) (result TriggerSubscriptionOperationStatus, err error) { 416 err = autorest.Respond( 417 resp, 418 azure.WithErrorUnlessStatusCode(http.StatusOK), 419 autorest.ByUnmarshallingJSON(&result), 420 autorest.ByClosing()) 421 result.Response = autorest.Response{Response: resp} 422 return 423} 424 425// ListByFactory lists triggers. 426// Parameters: 427// resourceGroupName - the resource group name. 428// factoryName - the factory name. 429func (client TriggersClient) ListByFactory(ctx context.Context, resourceGroupName string, factoryName string) (result TriggerListResponsePage, err error) { 430 if tracing.IsEnabled() { 431 ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.ListByFactory") 432 defer func() { 433 sc := -1 434 if result.tlr.Response.Response != nil { 435 sc = result.tlr.Response.Response.StatusCode 436 } 437 tracing.EndSpan(ctx, sc, err) 438 }() 439 } 440 if err := validation.Validate([]validation.Validation{ 441 {TargetValue: resourceGroupName, 442 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 443 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 444 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 445 {TargetValue: factoryName, 446 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 447 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 448 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil { 449 return result, validation.NewError("datafactory.TriggersClient", "ListByFactory", err.Error()) 450 } 451 452 result.fn = client.listByFactoryNextResults 453 req, err := client.ListByFactoryPreparer(ctx, resourceGroupName, factoryName) 454 if err != nil { 455 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "ListByFactory", nil, "Failure preparing request") 456 return 457 } 458 459 resp, err := client.ListByFactorySender(req) 460 if err != nil { 461 result.tlr.Response = autorest.Response{Response: resp} 462 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "ListByFactory", resp, "Failure sending request") 463 return 464 } 465 466 result.tlr, err = client.ListByFactoryResponder(resp) 467 if err != nil { 468 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "ListByFactory", resp, "Failure responding to request") 469 return 470 } 471 if result.tlr.hasNextLink() && result.tlr.IsEmpty() { 472 err = result.NextWithContext(ctx) 473 return 474 } 475 476 return 477} 478 479// ListByFactoryPreparer prepares the ListByFactory request. 480func (client TriggersClient) ListByFactoryPreparer(ctx context.Context, resourceGroupName string, factoryName string) (*http.Request, error) { 481 pathParameters := map[string]interface{}{ 482 "factoryName": autorest.Encode("path", factoryName), 483 "resourceGroupName": autorest.Encode("path", resourceGroupName), 484 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 485 } 486 487 const APIVersion = "2018-06-01" 488 queryParameters := map[string]interface{}{ 489 "api-version": APIVersion, 490 } 491 492 preparer := autorest.CreatePreparer( 493 autorest.AsGet(), 494 autorest.WithBaseURL(client.BaseURI), 495 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers", pathParameters), 496 autorest.WithQueryParameters(queryParameters)) 497 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 498} 499 500// ListByFactorySender sends the ListByFactory request. The method will close the 501// http.Response Body if it receives an error. 502func (client TriggersClient) ListByFactorySender(req *http.Request) (*http.Response, error) { 503 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 504} 505 506// ListByFactoryResponder handles the response to the ListByFactory request. The method always 507// closes the http.Response Body. 508func (client TriggersClient) ListByFactoryResponder(resp *http.Response) (result TriggerListResponse, err error) { 509 err = autorest.Respond( 510 resp, 511 azure.WithErrorUnlessStatusCode(http.StatusOK), 512 autorest.ByUnmarshallingJSON(&result), 513 autorest.ByClosing()) 514 result.Response = autorest.Response{Response: resp} 515 return 516} 517 518// listByFactoryNextResults retrieves the next set of results, if any. 519func (client TriggersClient) listByFactoryNextResults(ctx context.Context, lastResults TriggerListResponse) (result TriggerListResponse, err error) { 520 req, err := lastResults.triggerListResponsePreparer(ctx) 521 if err != nil { 522 return result, autorest.NewErrorWithError(err, "datafactory.TriggersClient", "listByFactoryNextResults", nil, "Failure preparing next results request") 523 } 524 if req == nil { 525 return 526 } 527 resp, err := client.ListByFactorySender(req) 528 if err != nil { 529 result.Response = autorest.Response{Response: resp} 530 return result, autorest.NewErrorWithError(err, "datafactory.TriggersClient", "listByFactoryNextResults", resp, "Failure sending next results request") 531 } 532 result, err = client.ListByFactoryResponder(resp) 533 if err != nil { 534 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "listByFactoryNextResults", resp, "Failure responding to next results request") 535 } 536 return 537} 538 539// ListByFactoryComplete enumerates all values, automatically crossing page boundaries as required. 540func (client TriggersClient) ListByFactoryComplete(ctx context.Context, resourceGroupName string, factoryName string) (result TriggerListResponseIterator, err error) { 541 if tracing.IsEnabled() { 542 ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.ListByFactory") 543 defer func() { 544 sc := -1 545 if result.Response().Response.Response != nil { 546 sc = result.page.Response().Response.Response.StatusCode 547 } 548 tracing.EndSpan(ctx, sc, err) 549 }() 550 } 551 result.page, err = client.ListByFactory(ctx, resourceGroupName, factoryName) 552 return 553} 554 555// QueryByFactory query triggers. 556// Parameters: 557// resourceGroupName - the resource group name. 558// factoryName - the factory name. 559// filterParameters - parameters to filter the triggers. 560func (client TriggersClient) QueryByFactory(ctx context.Context, resourceGroupName string, factoryName string, filterParameters TriggerFilterParameters) (result TriggerQueryResponse, err error) { 561 if tracing.IsEnabled() { 562 ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.QueryByFactory") 563 defer func() { 564 sc := -1 565 if result.Response.Response != nil { 566 sc = result.Response.Response.StatusCode 567 } 568 tracing.EndSpan(ctx, sc, err) 569 }() 570 } 571 if err := validation.Validate([]validation.Validation{ 572 {TargetValue: resourceGroupName, 573 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 574 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 575 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 576 {TargetValue: factoryName, 577 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 578 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 579 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil { 580 return result, validation.NewError("datafactory.TriggersClient", "QueryByFactory", err.Error()) 581 } 582 583 req, err := client.QueryByFactoryPreparer(ctx, resourceGroupName, factoryName, filterParameters) 584 if err != nil { 585 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "QueryByFactory", nil, "Failure preparing request") 586 return 587 } 588 589 resp, err := client.QueryByFactorySender(req) 590 if err != nil { 591 result.Response = autorest.Response{Response: resp} 592 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "QueryByFactory", resp, "Failure sending request") 593 return 594 } 595 596 result, err = client.QueryByFactoryResponder(resp) 597 if err != nil { 598 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "QueryByFactory", resp, "Failure responding to request") 599 return 600 } 601 602 return 603} 604 605// QueryByFactoryPreparer prepares the QueryByFactory request. 606func (client TriggersClient) QueryByFactoryPreparer(ctx context.Context, resourceGroupName string, factoryName string, filterParameters TriggerFilterParameters) (*http.Request, error) { 607 pathParameters := map[string]interface{}{ 608 "factoryName": autorest.Encode("path", factoryName), 609 "resourceGroupName": autorest.Encode("path", resourceGroupName), 610 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 611 } 612 613 const APIVersion = "2018-06-01" 614 queryParameters := map[string]interface{}{ 615 "api-version": APIVersion, 616 } 617 618 preparer := autorest.CreatePreparer( 619 autorest.AsContentType("application/json; charset=utf-8"), 620 autorest.AsPost(), 621 autorest.WithBaseURL(client.BaseURI), 622 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/querytriggers", pathParameters), 623 autorest.WithJSON(filterParameters), 624 autorest.WithQueryParameters(queryParameters)) 625 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 626} 627 628// QueryByFactorySender sends the QueryByFactory request. The method will close the 629// http.Response Body if it receives an error. 630func (client TriggersClient) QueryByFactorySender(req *http.Request) (*http.Response, error) { 631 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 632} 633 634// QueryByFactoryResponder handles the response to the QueryByFactory request. The method always 635// closes the http.Response Body. 636func (client TriggersClient) QueryByFactoryResponder(resp *http.Response) (result TriggerQueryResponse, err error) { 637 err = autorest.Respond( 638 resp, 639 azure.WithErrorUnlessStatusCode(http.StatusOK), 640 autorest.ByUnmarshallingJSON(&result), 641 autorest.ByClosing()) 642 result.Response = autorest.Response{Response: resp} 643 return 644} 645 646// Start starts a trigger. 647// Parameters: 648// resourceGroupName - the resource group name. 649// factoryName - the factory name. 650// triggerName - the trigger name. 651func (client TriggersClient) Start(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (result TriggersStartFuture, err error) { 652 if tracing.IsEnabled() { 653 ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.Start") 654 defer func() { 655 sc := -1 656 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 657 sc = result.FutureAPI.Response().StatusCode 658 } 659 tracing.EndSpan(ctx, sc, err) 660 }() 661 } 662 if err := validation.Validate([]validation.Validation{ 663 {TargetValue: resourceGroupName, 664 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 665 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 666 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 667 {TargetValue: factoryName, 668 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 669 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 670 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, 671 {TargetValue: triggerName, 672 Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, 673 {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, 674 {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { 675 return result, validation.NewError("datafactory.TriggersClient", "Start", err.Error()) 676 } 677 678 req, err := client.StartPreparer(ctx, resourceGroupName, factoryName, triggerName) 679 if err != nil { 680 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Start", nil, "Failure preparing request") 681 return 682 } 683 684 result, err = client.StartSender(req) 685 if err != nil { 686 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Start", nil, "Failure sending request") 687 return 688 } 689 690 return 691} 692 693// StartPreparer prepares the Start request. 694func (client TriggersClient) StartPreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (*http.Request, error) { 695 pathParameters := map[string]interface{}{ 696 "factoryName": autorest.Encode("path", factoryName), 697 "resourceGroupName": autorest.Encode("path", resourceGroupName), 698 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 699 "triggerName": autorest.Encode("path", triggerName), 700 } 701 702 const APIVersion = "2018-06-01" 703 queryParameters := map[string]interface{}{ 704 "api-version": APIVersion, 705 } 706 707 preparer := autorest.CreatePreparer( 708 autorest.AsPost(), 709 autorest.WithBaseURL(client.BaseURI), 710 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/start", pathParameters), 711 autorest.WithQueryParameters(queryParameters)) 712 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 713} 714 715// StartSender sends the Start request. The method will close the 716// http.Response Body if it receives an error. 717func (client TriggersClient) StartSender(req *http.Request) (future TriggersStartFuture, err error) { 718 var resp *http.Response 719 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 720 if err != nil { 721 return 722 } 723 var azf azure.Future 724 azf, err = azure.NewFutureFromResponse(resp) 725 future.FutureAPI = &azf 726 future.Result = future.result 727 return 728} 729 730// StartResponder handles the response to the Start request. The method always 731// closes the http.Response Body. 732func (client TriggersClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { 733 err = autorest.Respond( 734 resp, 735 azure.WithErrorUnlessStatusCode(http.StatusOK), 736 autorest.ByClosing()) 737 result.Response = resp 738 return 739} 740 741// Stop stops a trigger. 742// Parameters: 743// resourceGroupName - the resource group name. 744// factoryName - the factory name. 745// triggerName - the trigger name. 746func (client TriggersClient) Stop(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (result TriggersStopFuture, err error) { 747 if tracing.IsEnabled() { 748 ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.Stop") 749 defer func() { 750 sc := -1 751 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 752 sc = result.FutureAPI.Response().StatusCode 753 } 754 tracing.EndSpan(ctx, sc, err) 755 }() 756 } 757 if err := validation.Validate([]validation.Validation{ 758 {TargetValue: resourceGroupName, 759 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 760 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 761 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 762 {TargetValue: factoryName, 763 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 764 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 765 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, 766 {TargetValue: triggerName, 767 Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, 768 {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, 769 {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { 770 return result, validation.NewError("datafactory.TriggersClient", "Stop", err.Error()) 771 } 772 773 req, err := client.StopPreparer(ctx, resourceGroupName, factoryName, triggerName) 774 if err != nil { 775 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Stop", nil, "Failure preparing request") 776 return 777 } 778 779 result, err = client.StopSender(req) 780 if err != nil { 781 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "Stop", nil, "Failure sending request") 782 return 783 } 784 785 return 786} 787 788// StopPreparer prepares the Stop request. 789func (client TriggersClient) StopPreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (*http.Request, error) { 790 pathParameters := map[string]interface{}{ 791 "factoryName": autorest.Encode("path", factoryName), 792 "resourceGroupName": autorest.Encode("path", resourceGroupName), 793 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 794 "triggerName": autorest.Encode("path", triggerName), 795 } 796 797 const APIVersion = "2018-06-01" 798 queryParameters := map[string]interface{}{ 799 "api-version": APIVersion, 800 } 801 802 preparer := autorest.CreatePreparer( 803 autorest.AsPost(), 804 autorest.WithBaseURL(client.BaseURI), 805 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/stop", pathParameters), 806 autorest.WithQueryParameters(queryParameters)) 807 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 808} 809 810// StopSender sends the Stop request. The method will close the 811// http.Response Body if it receives an error. 812func (client TriggersClient) StopSender(req *http.Request) (future TriggersStopFuture, err error) { 813 var resp *http.Response 814 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 815 if err != nil { 816 return 817 } 818 var azf azure.Future 819 azf, err = azure.NewFutureFromResponse(resp) 820 future.FutureAPI = &azf 821 future.Result = future.result 822 return 823} 824 825// StopResponder handles the response to the Stop request. The method always 826// closes the http.Response Body. 827func (client TriggersClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { 828 err = autorest.Respond( 829 resp, 830 azure.WithErrorUnlessStatusCode(http.StatusOK), 831 autorest.ByClosing()) 832 result.Response = resp 833 return 834} 835 836// SubscribeToEvents subscribe event trigger to events. 837// Parameters: 838// resourceGroupName - the resource group name. 839// factoryName - the factory name. 840// triggerName - the trigger name. 841func (client TriggersClient) SubscribeToEvents(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (result TriggersSubscribeToEventsFuture, err error) { 842 if tracing.IsEnabled() { 843 ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.SubscribeToEvents") 844 defer func() { 845 sc := -1 846 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 847 sc = result.FutureAPI.Response().StatusCode 848 } 849 tracing.EndSpan(ctx, sc, err) 850 }() 851 } 852 if err := validation.Validate([]validation.Validation{ 853 {TargetValue: resourceGroupName, 854 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 855 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 856 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 857 {TargetValue: factoryName, 858 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 859 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 860 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, 861 {TargetValue: triggerName, 862 Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, 863 {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, 864 {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { 865 return result, validation.NewError("datafactory.TriggersClient", "SubscribeToEvents", err.Error()) 866 } 867 868 req, err := client.SubscribeToEventsPreparer(ctx, resourceGroupName, factoryName, triggerName) 869 if err != nil { 870 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "SubscribeToEvents", nil, "Failure preparing request") 871 return 872 } 873 874 result, err = client.SubscribeToEventsSender(req) 875 if err != nil { 876 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "SubscribeToEvents", nil, "Failure sending request") 877 return 878 } 879 880 return 881} 882 883// SubscribeToEventsPreparer prepares the SubscribeToEvents request. 884func (client TriggersClient) SubscribeToEventsPreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (*http.Request, error) { 885 pathParameters := map[string]interface{}{ 886 "factoryName": autorest.Encode("path", factoryName), 887 "resourceGroupName": autorest.Encode("path", resourceGroupName), 888 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 889 "triggerName": autorest.Encode("path", triggerName), 890 } 891 892 const APIVersion = "2018-06-01" 893 queryParameters := map[string]interface{}{ 894 "api-version": APIVersion, 895 } 896 897 preparer := autorest.CreatePreparer( 898 autorest.AsPost(), 899 autorest.WithBaseURL(client.BaseURI), 900 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/subscribeToEvents", pathParameters), 901 autorest.WithQueryParameters(queryParameters)) 902 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 903} 904 905// SubscribeToEventsSender sends the SubscribeToEvents request. The method will close the 906// http.Response Body if it receives an error. 907func (client TriggersClient) SubscribeToEventsSender(req *http.Request) (future TriggersSubscribeToEventsFuture, err error) { 908 var resp *http.Response 909 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 910 if err != nil { 911 return 912 } 913 var azf azure.Future 914 azf, err = azure.NewFutureFromResponse(resp) 915 future.FutureAPI = &azf 916 future.Result = future.result 917 return 918} 919 920// SubscribeToEventsResponder handles the response to the SubscribeToEvents request. The method always 921// closes the http.Response Body. 922func (client TriggersClient) SubscribeToEventsResponder(resp *http.Response) (result TriggerSubscriptionOperationStatus, err error) { 923 err = autorest.Respond( 924 resp, 925 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 926 autorest.ByUnmarshallingJSON(&result), 927 autorest.ByClosing()) 928 result.Response = autorest.Response{Response: resp} 929 return 930} 931 932// UnsubscribeFromEvents unsubscribe event trigger from events. 933// Parameters: 934// resourceGroupName - the resource group name. 935// factoryName - the factory name. 936// triggerName - the trigger name. 937func (client TriggersClient) UnsubscribeFromEvents(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (result TriggersUnsubscribeFromEventsFuture, err error) { 938 if tracing.IsEnabled() { 939 ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.UnsubscribeFromEvents") 940 defer func() { 941 sc := -1 942 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 943 sc = result.FutureAPI.Response().StatusCode 944 } 945 tracing.EndSpan(ctx, sc, err) 946 }() 947 } 948 if err := validation.Validate([]validation.Validation{ 949 {TargetValue: resourceGroupName, 950 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 951 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 952 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, 953 {TargetValue: factoryName, 954 Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, 955 {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, 956 {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, 957 {TargetValue: triggerName, 958 Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, 959 {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, 960 {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { 961 return result, validation.NewError("datafactory.TriggersClient", "UnsubscribeFromEvents", err.Error()) 962 } 963 964 req, err := client.UnsubscribeFromEventsPreparer(ctx, resourceGroupName, factoryName, triggerName) 965 if err != nil { 966 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "UnsubscribeFromEvents", nil, "Failure preparing request") 967 return 968 } 969 970 result, err = client.UnsubscribeFromEventsSender(req) 971 if err != nil { 972 err = autorest.NewErrorWithError(err, "datafactory.TriggersClient", "UnsubscribeFromEvents", nil, "Failure sending request") 973 return 974 } 975 976 return 977} 978 979// UnsubscribeFromEventsPreparer prepares the UnsubscribeFromEvents request. 980func (client TriggersClient) UnsubscribeFromEventsPreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (*http.Request, error) { 981 pathParameters := map[string]interface{}{ 982 "factoryName": autorest.Encode("path", factoryName), 983 "resourceGroupName": autorest.Encode("path", resourceGroupName), 984 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 985 "triggerName": autorest.Encode("path", triggerName), 986 } 987 988 const APIVersion = "2018-06-01" 989 queryParameters := map[string]interface{}{ 990 "api-version": APIVersion, 991 } 992 993 preparer := autorest.CreatePreparer( 994 autorest.AsPost(), 995 autorest.WithBaseURL(client.BaseURI), 996 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/unsubscribeFromEvents", pathParameters), 997 autorest.WithQueryParameters(queryParameters)) 998 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 999} 1000 1001// UnsubscribeFromEventsSender sends the UnsubscribeFromEvents request. The method will close the 1002// http.Response Body if it receives an error. 1003func (client TriggersClient) UnsubscribeFromEventsSender(req *http.Request) (future TriggersUnsubscribeFromEventsFuture, err error) { 1004 var resp *http.Response 1005 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1006 if err != nil { 1007 return 1008 } 1009 var azf azure.Future 1010 azf, err = azure.NewFutureFromResponse(resp) 1011 future.FutureAPI = &azf 1012 future.Result = future.result 1013 return 1014} 1015 1016// UnsubscribeFromEventsResponder handles the response to the UnsubscribeFromEvents request. The method always 1017// closes the http.Response Body. 1018func (client TriggersClient) UnsubscribeFromEventsResponder(resp *http.Response) (result TriggerSubscriptionOperationStatus, err error) { 1019 err = autorest.Respond( 1020 resp, 1021 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1022 autorest.ByUnmarshallingJSON(&result), 1023 autorest.ByClosing()) 1024 result.Response = autorest.Response{Response: resp} 1025 return 1026} 1027