diff --git a/profiles/preview/datafactory/mgmt/datafactory/models.go b/profiles/preview/datafactory/mgmt/datafactory/models.go index 62144fdda5c9..dd33dc722781 100644 --- a/profiles/preview/datafactory/mgmt/datafactory/models.go +++ b/profiles/preview/datafactory/mgmt/datafactory/models.go @@ -854,12 +854,13 @@ const ( type TypeBasicTrigger = original.TypeBasicTrigger const ( - TypeBlobEventsTrigger TypeBasicTrigger = original.TypeBlobEventsTrigger - TypeBlobTrigger TypeBasicTrigger = original.TypeBlobTrigger - TypeMultiplePipelineTrigger TypeBasicTrigger = original.TypeMultiplePipelineTrigger - TypeScheduleTrigger TypeBasicTrigger = original.TypeScheduleTrigger - TypeTrigger TypeBasicTrigger = original.TypeTrigger - TypeTumblingWindowTrigger TypeBasicTrigger = original.TypeTumblingWindowTrigger + TypeBlobEventsTrigger TypeBasicTrigger = original.TypeBlobEventsTrigger + TypeBlobTrigger TypeBasicTrigger = original.TypeBlobTrigger + TypeMultiplePipelineTrigger TypeBasicTrigger = original.TypeMultiplePipelineTrigger + TypeRerunTumblingWindowTrigger TypeBasicTrigger = original.TypeRerunTumblingWindowTrigger + TypeScheduleTrigger TypeBasicTrigger = original.TypeScheduleTrigger + TypeTrigger TypeBasicTrigger = original.TypeTrigger + TypeTumblingWindowTrigger TypeBasicTrigger = original.TypeTumblingWindowTrigger ) type VariableType = original.VariableType @@ -1264,6 +1265,16 @@ type RedshiftUnloadSettings = original.RedshiftUnloadSettings type RelationalSource = original.RelationalSource type RelationalTableDataset = original.RelationalTableDataset type RelationalTableDatasetTypeProperties = original.RelationalTableDatasetTypeProperties +type RerunTriggerListResponse = original.RerunTriggerListResponse +type RerunTriggerListResponseIterator = original.RerunTriggerListResponseIterator +type RerunTriggerListResponsePage = original.RerunTriggerListResponsePage +type RerunTriggerResource = original.RerunTriggerResource +type RerunTriggersCancelFuture = original.RerunTriggersCancelFuture +type RerunTriggersStartFuture = original.RerunTriggersStartFuture +type RerunTriggersStopFuture = original.RerunTriggersStopFuture +type RerunTumblingWindowTrigger = original.RerunTumblingWindowTrigger +type RerunTumblingWindowTriggerActionParameters = original.RerunTumblingWindowTriggerActionParameters +type RerunTumblingWindowTriggerTypeProperties = original.RerunTumblingWindowTriggerTypeProperties type Resource = original.Resource type ResponsysLinkedService = original.ResponsysLinkedService type ResponsysLinkedServiceTypeProperties = original.ResponsysLinkedServiceTypeProperties @@ -1405,6 +1416,7 @@ type ZohoSource = original.ZohoSource type OperationsClient = original.OperationsClient type PipelineRunsClient = original.PipelineRunsClient type PipelinesClient = original.PipelinesClient +type RerunTriggersClient = original.RerunTriggersClient type TriggerRunsClient = original.TriggerRunsClient type TriggersClient = original.TriggersClient @@ -1693,6 +1705,12 @@ func NewPipelinesClient(subscriptionID string) PipelinesClient { func NewPipelinesClientWithBaseURI(baseURI string, subscriptionID string) PipelinesClient { return original.NewPipelinesClientWithBaseURI(baseURI, subscriptionID) } +func NewRerunTriggersClient(subscriptionID string) RerunTriggersClient { + return original.NewRerunTriggersClient(subscriptionID) +} +func NewRerunTriggersClientWithBaseURI(baseURI string, subscriptionID string) RerunTriggersClient { + return original.NewRerunTriggersClientWithBaseURI(baseURI, subscriptionID) +} func NewTriggerRunsClient(subscriptionID string) TriggerRunsClient { return original.NewTriggerRunsClient(subscriptionID) } diff --git a/services/datafactory/mgmt/2018-06-01/datafactory/models.go b/services/datafactory/mgmt/2018-06-01/datafactory/models.go index 4662c4d78980..bdd424f17a19 100644 --- a/services/datafactory/mgmt/2018-06-01/datafactory/models.go +++ b/services/datafactory/mgmt/2018-06-01/datafactory/models.go @@ -1748,6 +1748,8 @@ const ( TypeBlobTrigger TypeBasicTrigger = "BlobTrigger" // TypeMultiplePipelineTrigger ... TypeMultiplePipelineTrigger TypeBasicTrigger = "MultiplePipelineTrigger" + // TypeRerunTumblingWindowTrigger ... + TypeRerunTumblingWindowTrigger TypeBasicTrigger = "RerunTumblingWindowTrigger" // TypeScheduleTrigger ... TypeScheduleTrigger TypeBasicTrigger = "ScheduleTrigger" // TypeTrigger ... @@ -1758,7 +1760,7 @@ const ( // PossibleTypeBasicTriggerValues returns an array of possible values for the TypeBasicTrigger const type. func PossibleTypeBasicTriggerValues() []TypeBasicTrigger { - return []TypeBasicTrigger{TypeBlobEventsTrigger, TypeBlobTrigger, TypeMultiplePipelineTrigger, TypeScheduleTrigger, TypeTrigger, TypeTumblingWindowTrigger} + return []TypeBasicTrigger{TypeBlobEventsTrigger, TypeBlobTrigger, TypeMultiplePipelineTrigger, TypeRerunTumblingWindowTrigger, TypeScheduleTrigger, TypeTrigger, TypeTumblingWindowTrigger} } // VariableType enumerates the values for variable type. @@ -20871,7 +20873,7 @@ type BlobEventsTrigger struct { Description *string `json:"description,omitempty"` // RuntimeState - Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. Possible values include: 'TriggerRuntimeStateStarted', 'TriggerRuntimeStateStopped', 'TriggerRuntimeStateDisabled' RuntimeState TriggerRuntimeState `json:"runtimeState,omitempty"` - // Type - Possible values include: 'TypeTrigger', 'TypeTumblingWindowTrigger', 'TypeBlobEventsTrigger', 'TypeBlobTrigger', 'TypeScheduleTrigger', 'TypeMultiplePipelineTrigger' + // Type - Possible values include: 'TypeTrigger', 'TypeRerunTumblingWindowTrigger', 'TypeTumblingWindowTrigger', 'TypeBlobEventsTrigger', 'TypeBlobTrigger', 'TypeScheduleTrigger', 'TypeMultiplePipelineTrigger' Type TypeBasicTrigger `json:"type,omitempty"` } @@ -20900,6 +20902,11 @@ func (bet BlobEventsTrigger) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// AsRerunTumblingWindowTrigger is the BasicTrigger implementation for BlobEventsTrigger. +func (bet BlobEventsTrigger) AsRerunTumblingWindowTrigger() (*RerunTumblingWindowTrigger, bool) { + return nil, false +} + // AsTumblingWindowTrigger is the BasicTrigger implementation for BlobEventsTrigger. func (bet BlobEventsTrigger) AsTumblingWindowTrigger() (*TumblingWindowTrigger, bool) { return nil, false @@ -21648,7 +21655,7 @@ type BlobTrigger struct { Description *string `json:"description,omitempty"` // RuntimeState - Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. Possible values include: 'TriggerRuntimeStateStarted', 'TriggerRuntimeStateStopped', 'TriggerRuntimeStateDisabled' RuntimeState TriggerRuntimeState `json:"runtimeState,omitempty"` - // Type - Possible values include: 'TypeTrigger', 'TypeTumblingWindowTrigger', 'TypeBlobEventsTrigger', 'TypeBlobTrigger', 'TypeScheduleTrigger', 'TypeMultiplePipelineTrigger' + // Type - Possible values include: 'TypeTrigger', 'TypeRerunTumblingWindowTrigger', 'TypeTumblingWindowTrigger', 'TypeBlobEventsTrigger', 'TypeBlobTrigger', 'TypeScheduleTrigger', 'TypeMultiplePipelineTrigger' Type TypeBasicTrigger `json:"type,omitempty"` } @@ -21677,6 +21684,11 @@ func (bt BlobTrigger) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// AsRerunTumblingWindowTrigger is the BasicTrigger implementation for BlobTrigger. +func (bt BlobTrigger) AsRerunTumblingWindowTrigger() (*RerunTumblingWindowTrigger, bool) { + return nil, false +} + // AsTumblingWindowTrigger is the BasicTrigger implementation for BlobTrigger. func (bt BlobTrigger) AsTumblingWindowTrigger() (*TumblingWindowTrigger, bool) { return nil, false @@ -67867,7 +67879,7 @@ type MultiplePipelineTrigger struct { Description *string `json:"description,omitempty"` // RuntimeState - Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. Possible values include: 'TriggerRuntimeStateStarted', 'TriggerRuntimeStateStopped', 'TriggerRuntimeStateDisabled' RuntimeState TriggerRuntimeState `json:"runtimeState,omitempty"` - // Type - Possible values include: 'TypeTrigger', 'TypeTumblingWindowTrigger', 'TypeBlobEventsTrigger', 'TypeBlobTrigger', 'TypeScheduleTrigger', 'TypeMultiplePipelineTrigger' + // Type - Possible values include: 'TypeTrigger', 'TypeRerunTumblingWindowTrigger', 'TypeTumblingWindowTrigger', 'TypeBlobEventsTrigger', 'TypeBlobTrigger', 'TypeScheduleTrigger', 'TypeMultiplePipelineTrigger' Type TypeBasicTrigger `json:"type,omitempty"` } @@ -67938,6 +67950,11 @@ func (mpt MultiplePipelineTrigger) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// AsRerunTumblingWindowTrigger is the BasicTrigger implementation for MultiplePipelineTrigger. +func (mpt MultiplePipelineTrigger) AsRerunTumblingWindowTrigger() (*RerunTumblingWindowTrigger, bool) { + return nil, false +} + // AsTumblingWindowTrigger is the BasicTrigger implementation for MultiplePipelineTrigger. func (mpt MultiplePipelineTrigger) AsTumblingWindowTrigger() (*TumblingWindowTrigger, bool) { return nil, false @@ -81439,6 +81456,355 @@ type RelationalTableDatasetTypeProperties struct { TableName interface{} `json:"tableName,omitempty"` } +// RerunTriggerListResponse a list of rerun triggers. +type RerunTriggerListResponse struct { + autorest.Response `json:"-"` + // Value - List of rerun triggers. + Value *[]RerunTriggerResource `json:"value,omitempty"` + // NextLink - The continuation token for getting the next page of results, if any remaining results exist, null otherwise. + NextLink *string `json:"nextLink,omitempty"` +} + +// RerunTriggerListResponseIterator provides access to a complete listing of RerunTriggerResource values. +type RerunTriggerListResponseIterator struct { + i int + page RerunTriggerListResponsePage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RerunTriggerListResponseIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RerunTriggerListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RerunTriggerListResponseIterator) Response() RerunTriggerListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RerunTriggerListResponseIterator) Value() RerunTriggerResource { + if !iter.page.NotDone() { + return RerunTriggerResource{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rtlr RerunTriggerListResponse) IsEmpty() bool { + return rtlr.Value == nil || len(*rtlr.Value) == 0 +} + +// rerunTriggerListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rtlr RerunTriggerListResponse) rerunTriggerListResponsePreparer() (*http.Request, error) { + if rtlr.NextLink == nil || len(to.String(rtlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rtlr.NextLink))) +} + +// RerunTriggerListResponsePage contains a page of RerunTriggerResource values. +type RerunTriggerListResponsePage struct { + fn func(RerunTriggerListResponse) (RerunTriggerListResponse, error) + rtlr RerunTriggerListResponse +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RerunTriggerListResponsePage) Next() error { + next, err := page.fn(page.rtlr) + if err != nil { + return err + } + page.rtlr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RerunTriggerListResponsePage) NotDone() bool { + return !page.rtlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RerunTriggerListResponsePage) Response() RerunTriggerListResponse { + return page.rtlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RerunTriggerListResponsePage) Values() []RerunTriggerResource { + if page.rtlr.IsEmpty() { + return nil + } + return *page.rtlr.Value +} + +// RerunTriggerResource rerunTrigger resource type. +type RerunTriggerResource struct { + // Properties - Properties of the rerun trigger. + Properties *RerunTumblingWindowTrigger `json:"properties,omitempty"` + // ID - The resource identifier. + ID *string `json:"id,omitempty"` + // Name - The resource name. + Name *string `json:"name,omitempty"` + // Type - The resource type. + Type *string `json:"type,omitempty"` + // Etag - Etag identifies change in the resource. + Etag *string `json:"etag,omitempty"` +} + +// RerunTriggersCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RerunTriggersCancelFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *RerunTriggersCancelFuture) Result(client RerunTriggersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersCancelFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("datafactory.RerunTriggersCancelFuture") + return + } + ar.Response = future.Response() + return +} + +// RerunTriggersStartFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RerunTriggersStartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *RerunTriggersStartFuture) Result(client RerunTriggersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("datafactory.RerunTriggersStartFuture") + return + } + ar.Response = future.Response() + return +} + +// RerunTriggersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RerunTriggersStopFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *RerunTriggersStopFuture) Result(client RerunTriggersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("datafactory.RerunTriggersStopFuture") + return + } + ar.Response = future.Response() + return +} + +// RerunTumblingWindowTrigger trigger that schedules pipeline reruns for all fixed time interval windows from a +// requested start time to requested end time. +type RerunTumblingWindowTrigger struct { + // RerunTumblingWindowTriggerTypeProperties - Rerun Trigger properties. + *RerunTumblingWindowTriggerTypeProperties `json:"typeProperties,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Description - Trigger description. + Description *string `json:"description,omitempty"` + // RuntimeState - Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. Possible values include: 'TriggerRuntimeStateStarted', 'TriggerRuntimeStateStopped', 'TriggerRuntimeStateDisabled' + RuntimeState TriggerRuntimeState `json:"runtimeState,omitempty"` + // Type - Possible values include: 'TypeTrigger', 'TypeRerunTumblingWindowTrigger', 'TypeTumblingWindowTrigger', 'TypeBlobEventsTrigger', 'TypeBlobTrigger', 'TypeScheduleTrigger', 'TypeMultiplePipelineTrigger' + Type TypeBasicTrigger `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RerunTumblingWindowTrigger. +func (rtwt RerunTumblingWindowTrigger) MarshalJSON() ([]byte, error) { + rtwt.Type = TypeRerunTumblingWindowTrigger + objectMap := make(map[string]interface{}) + if rtwt.RerunTumblingWindowTriggerTypeProperties != nil { + objectMap["typeProperties"] = rtwt.RerunTumblingWindowTriggerTypeProperties + } + if rtwt.Description != nil { + objectMap["description"] = rtwt.Description + } + if rtwt.RuntimeState != "" { + objectMap["runtimeState"] = rtwt.RuntimeState + } + if rtwt.Type != "" { + objectMap["type"] = rtwt.Type + } + for k, v := range rtwt.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsRerunTumblingWindowTrigger is the BasicTrigger implementation for RerunTumblingWindowTrigger. +func (rtwt RerunTumblingWindowTrigger) AsRerunTumblingWindowTrigger() (*RerunTumblingWindowTrigger, bool) { + return &rtwt, true +} + +// AsTumblingWindowTrigger is the BasicTrigger implementation for RerunTumblingWindowTrigger. +func (rtwt RerunTumblingWindowTrigger) AsTumblingWindowTrigger() (*TumblingWindowTrigger, bool) { + return nil, false +} + +// AsBlobEventsTrigger is the BasicTrigger implementation for RerunTumblingWindowTrigger. +func (rtwt RerunTumblingWindowTrigger) AsBlobEventsTrigger() (*BlobEventsTrigger, bool) { + return nil, false +} + +// AsBlobTrigger is the BasicTrigger implementation for RerunTumblingWindowTrigger. +func (rtwt RerunTumblingWindowTrigger) AsBlobTrigger() (*BlobTrigger, bool) { + return nil, false +} + +// AsScheduleTrigger is the BasicTrigger implementation for RerunTumblingWindowTrigger. +func (rtwt RerunTumblingWindowTrigger) AsScheduleTrigger() (*ScheduleTrigger, bool) { + return nil, false +} + +// AsMultiplePipelineTrigger is the BasicTrigger implementation for RerunTumblingWindowTrigger. +func (rtwt RerunTumblingWindowTrigger) AsMultiplePipelineTrigger() (*MultiplePipelineTrigger, bool) { + return nil, false +} + +// AsBasicMultiplePipelineTrigger is the BasicTrigger implementation for RerunTumblingWindowTrigger. +func (rtwt RerunTumblingWindowTrigger) AsBasicMultiplePipelineTrigger() (BasicMultiplePipelineTrigger, bool) { + return nil, false +} + +// AsTrigger is the BasicTrigger implementation for RerunTumblingWindowTrigger. +func (rtwt RerunTumblingWindowTrigger) AsTrigger() (*Trigger, bool) { + return nil, false +} + +// AsBasicTrigger is the BasicTrigger implementation for RerunTumblingWindowTrigger. +func (rtwt RerunTumblingWindowTrigger) AsBasicTrigger() (BasicTrigger, bool) { + return &rtwt, true +} + +// UnmarshalJSON is the custom unmarshaler for RerunTumblingWindowTrigger struct. +func (rtwt *RerunTumblingWindowTrigger) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "typeProperties": + if v != nil { + var rerunTumblingWindowTriggerTypeProperties RerunTumblingWindowTriggerTypeProperties + err = json.Unmarshal(*v, &rerunTumblingWindowTriggerTypeProperties) + if err != nil { + return err + } + rtwt.RerunTumblingWindowTriggerTypeProperties = &rerunTumblingWindowTriggerTypeProperties + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if rtwt.AdditionalProperties == nil { + rtwt.AdditionalProperties = make(map[string]interface{}) + } + rtwt.AdditionalProperties[k] = additionalProperties + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + rtwt.Description = &description + } + case "runtimeState": + if v != nil { + var runtimeState TriggerRuntimeState + err = json.Unmarshal(*v, &runtimeState) + if err != nil { + return err + } + rtwt.RuntimeState = runtimeState + } + case "type": + if v != nil { + var typeVar TypeBasicTrigger + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rtwt.Type = typeVar + } + } + } + + return nil +} + +// RerunTumblingWindowTriggerActionParameters rerun tumbling window trigger Parameters. +type RerunTumblingWindowTriggerActionParameters struct { + // StartTime - The start time for the time period for which restatement is initiated. Only UTC time is currently supported. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - The end time for the time period for which restatement is initiated. Only UTC time is currently supported. + EndTime *date.Time `json:"endTime,omitempty"` + // MaxConcurrency - The max number of parallel time windows (ready for execution) for which a rerun is triggered. + MaxConcurrency *int32 `json:"maxConcurrency,omitempty"` +} + +// RerunTumblingWindowTriggerTypeProperties rerun Trigger properties. +type RerunTumblingWindowTriggerTypeProperties struct { + // ParentTrigger - The parent trigger reference. + ParentTrigger interface{} `json:"parentTrigger,omitempty"` + // RequestedStartTime - The start time for the time period for which restatement is initiated. Only UTC time is currently supported. + RequestedStartTime *date.Time `json:"requestedStartTime,omitempty"` + // RequestedEndTime - The end time for the time period for which restatement is initiated. Only UTC time is currently supported. + RequestedEndTime *date.Time `json:"requestedEndTime,omitempty"` + // MaxConcurrency - The max number of parallel time windows (ready for execution) for which a rerun is triggered. + MaxConcurrency *int32 `json:"maxConcurrency,omitempty"` +} + // Resource azure Data Factory top-level resource. type Resource struct { // ID - The resource identifier. @@ -89875,7 +90241,7 @@ type ScheduleTrigger struct { Description *string `json:"description,omitempty"` // RuntimeState - Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. Possible values include: 'TriggerRuntimeStateStarted', 'TriggerRuntimeStateStopped', 'TriggerRuntimeStateDisabled' RuntimeState TriggerRuntimeState `json:"runtimeState,omitempty"` - // Type - Possible values include: 'TypeTrigger', 'TypeTumblingWindowTrigger', 'TypeBlobEventsTrigger', 'TypeBlobTrigger', 'TypeScheduleTrigger', 'TypeMultiplePipelineTrigger' + // Type - Possible values include: 'TypeTrigger', 'TypeRerunTumblingWindowTrigger', 'TypeTumblingWindowTrigger', 'TypeBlobEventsTrigger', 'TypeBlobTrigger', 'TypeScheduleTrigger', 'TypeMultiplePipelineTrigger' Type TypeBasicTrigger `json:"type,omitempty"` } @@ -89904,6 +90270,11 @@ func (st ScheduleTrigger) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// AsRerunTumblingWindowTrigger is the BasicTrigger implementation for ScheduleTrigger. +func (st ScheduleTrigger) AsRerunTumblingWindowTrigger() (*RerunTumblingWindowTrigger, bool) { + return nil, false +} + // AsTumblingWindowTrigger is the BasicTrigger implementation for ScheduleTrigger. func (st ScheduleTrigger) AsTumblingWindowTrigger() (*TumblingWindowTrigger, bool) { return nil, false @@ -101403,6 +101774,7 @@ func (tf *TextFormat) UnmarshalJSON(body []byte) error { // BasicTrigger azure data factory nested object which contains information about creating pipeline run type BasicTrigger interface { + AsRerunTumblingWindowTrigger() (*RerunTumblingWindowTrigger, bool) AsTumblingWindowTrigger() (*TumblingWindowTrigger, bool) AsBlobEventsTrigger() (*BlobEventsTrigger, bool) AsBlobTrigger() (*BlobTrigger, bool) @@ -101420,7 +101792,7 @@ type Trigger struct { Description *string `json:"description,omitempty"` // RuntimeState - Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. Possible values include: 'TriggerRuntimeStateStarted', 'TriggerRuntimeStateStopped', 'TriggerRuntimeStateDisabled' RuntimeState TriggerRuntimeState `json:"runtimeState,omitempty"` - // Type - Possible values include: 'TypeTrigger', 'TypeTumblingWindowTrigger', 'TypeBlobEventsTrigger', 'TypeBlobTrigger', 'TypeScheduleTrigger', 'TypeMultiplePipelineTrigger' + // Type - Possible values include: 'TypeTrigger', 'TypeRerunTumblingWindowTrigger', 'TypeTumblingWindowTrigger', 'TypeBlobEventsTrigger', 'TypeBlobTrigger', 'TypeScheduleTrigger', 'TypeMultiplePipelineTrigger' Type TypeBasicTrigger `json:"type,omitempty"` } @@ -101432,6 +101804,10 @@ func unmarshalBasicTrigger(body []byte) (BasicTrigger, error) { } switch m["type"] { + case string(TypeRerunTumblingWindowTrigger): + var rtwt RerunTumblingWindowTrigger + err := json.Unmarshal(body, &rtwt) + return rtwt, err case string(TypeTumblingWindowTrigger): var twt TumblingWindowTrigger err := json.Unmarshal(body, &twt) @@ -101496,6 +101872,11 @@ func (t Trigger) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// AsRerunTumblingWindowTrigger is the BasicTrigger implementation for Trigger. +func (t Trigger) AsRerunTumblingWindowTrigger() (*RerunTumblingWindowTrigger, bool) { + return nil, false +} + // AsTumblingWindowTrigger is the BasicTrigger implementation for Trigger. func (t Trigger) AsTumblingWindowTrigger() (*TumblingWindowTrigger, bool) { return nil, false @@ -102108,7 +102489,7 @@ type TumblingWindowTrigger struct { Description *string `json:"description,omitempty"` // RuntimeState - Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. Possible values include: 'TriggerRuntimeStateStarted', 'TriggerRuntimeStateStopped', 'TriggerRuntimeStateDisabled' RuntimeState TriggerRuntimeState `json:"runtimeState,omitempty"` - // Type - Possible values include: 'TypeTrigger', 'TypeTumblingWindowTrigger', 'TypeBlobEventsTrigger', 'TypeBlobTrigger', 'TypeScheduleTrigger', 'TypeMultiplePipelineTrigger' + // Type - Possible values include: 'TypeTrigger', 'TypeRerunTumblingWindowTrigger', 'TypeTumblingWindowTrigger', 'TypeBlobEventsTrigger', 'TypeBlobTrigger', 'TypeScheduleTrigger', 'TypeMultiplePipelineTrigger' Type TypeBasicTrigger `json:"type,omitempty"` } @@ -102137,6 +102518,11 @@ func (twt TumblingWindowTrigger) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// AsRerunTumblingWindowTrigger is the BasicTrigger implementation for TumblingWindowTrigger. +func (twt TumblingWindowTrigger) AsRerunTumblingWindowTrigger() (*RerunTumblingWindowTrigger, bool) { + return nil, false +} + // AsTumblingWindowTrigger is the BasicTrigger implementation for TumblingWindowTrigger. func (twt TumblingWindowTrigger) AsTumblingWindowTrigger() (*TumblingWindowTrigger, bool) { return &twt, true diff --git a/services/datafactory/mgmt/2018-06-01/datafactory/reruntriggers.go b/services/datafactory/mgmt/2018-06-01/datafactory/reruntriggers.go new file mode 100644 index 000000000000..bf13fa9f62b4 --- /dev/null +++ b/services/datafactory/mgmt/2018-06-01/datafactory/reruntriggers.go @@ -0,0 +1,538 @@ +package datafactory + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// RerunTriggersClient is the the Azure Data Factory V2 management API provides a RESTful set of web services that +// interact with Azure Data Factory V2 services. +type RerunTriggersClient struct { + BaseClient +} + +// NewRerunTriggersClient creates an instance of the RerunTriggersClient client. +func NewRerunTriggersClient(subscriptionID string) RerunTriggersClient { + return NewRerunTriggersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRerunTriggersClientWithBaseURI creates an instance of the RerunTriggersClient client. +func NewRerunTriggersClientWithBaseURI(baseURI string, subscriptionID string) RerunTriggersClient { + return RerunTriggersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Cancel cancels a trigger. +// Parameters: +// resourceGroupName - the resource group name. +// factoryName - the factory name. +// triggerName - the trigger name. +// rerunTriggerName - the rerun trigger name. +func (client RerunTriggersClient) Cancel(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, rerunTriggerName string) (result RerunTriggersCancelFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: factoryName, + Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, + {TargetValue: triggerName, + Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, + {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}, + {TargetValue: rerunTriggerName, + Constraints: []validation.Constraint{{Target: "rerunTriggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, + {Target: "rerunTriggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "rerunTriggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datafactory.RerunTriggersClient", "Cancel", err.Error()) + } + + req, err := client.CancelPreparer(ctx, resourceGroupName, factoryName, triggerName, rerunTriggerName) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "Cancel", nil, "Failure preparing request") + return + } + + result, err = client.CancelSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "Cancel", result.Response(), "Failure sending request") + return + } + + return +} + +// CancelPreparer prepares the Cancel request. +func (client RerunTriggersClient) CancelPreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, rerunTriggerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "factoryName": autorest.Encode("path", factoryName), + "rerunTriggerName": autorest.Encode("path", rerunTriggerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "triggerName": autorest.Encode("path", triggerName), + } + + const APIVersion = "2018-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/rerunTriggers/{rerunTriggerName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelSender sends the Cancel request. The method will close the +// http.Response Body if it receives an error. +func (client RerunTriggersClient) CancelSender(req *http.Request) (future RerunTriggersCancelFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CancelResponder handles the response to the Cancel request. The method always +// closes the http.Response Body. +func (client RerunTriggersClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Create creates a rerun trigger. +// Parameters: +// resourceGroupName - the resource group name. +// factoryName - the factory name. +// triggerName - the trigger name. +// rerunTriggerName - the rerun trigger name. +// rerunTumblingWindowTriggerActionParameters - rerun tumbling window trigger action parameters. +func (client RerunTriggersClient) Create(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, rerunTriggerName string, rerunTumblingWindowTriggerActionParameters RerunTumblingWindowTriggerActionParameters) (result TriggerResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: factoryName, + Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, + {TargetValue: triggerName, + Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, + {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}, + {TargetValue: rerunTriggerName, + Constraints: []validation.Constraint{{Target: "rerunTriggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, + {Target: "rerunTriggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "rerunTriggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}, + {TargetValue: rerunTumblingWindowTriggerActionParameters, + Constraints: []validation.Constraint{{Target: "rerunTumblingWindowTriggerActionParameters.StartTime", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "rerunTumblingWindowTriggerActionParameters.EndTime", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "rerunTumblingWindowTriggerActionParameters.MaxConcurrency", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "rerunTumblingWindowTriggerActionParameters.MaxConcurrency", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, + {Target: "rerunTumblingWindowTriggerActionParameters.MaxConcurrency", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("datafactory.RerunTriggersClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, factoryName, triggerName, rerunTriggerName, rerunTumblingWindowTriggerActionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RerunTriggersClient) CreatePreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, rerunTriggerName string, rerunTumblingWindowTriggerActionParameters RerunTumblingWindowTriggerActionParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "factoryName": autorest.Encode("path", factoryName), + "rerunTriggerName": autorest.Encode("path", rerunTriggerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "triggerName": autorest.Encode("path", triggerName), + } + + const APIVersion = "2018-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/rerunTriggers/{rerunTriggerName}", pathParameters), + autorest.WithJSON(rerunTumblingWindowTriggerActionParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RerunTriggersClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RerunTriggersClient) CreateResponder(resp *http.Response) (result TriggerResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByTrigger lists rerun triggers by an original trigger name. +// Parameters: +// resourceGroupName - the resource group name. +// factoryName - the factory name. +// triggerName - the trigger name. +func (client RerunTriggersClient) ListByTrigger(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (result RerunTriggerListResponsePage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: factoryName, + Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, + {TargetValue: triggerName, + Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, + {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datafactory.RerunTriggersClient", "ListByTrigger", err.Error()) + } + + result.fn = client.listByTriggerNextResults + req, err := client.ListByTriggerPreparer(ctx, resourceGroupName, factoryName, triggerName) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "ListByTrigger", nil, "Failure preparing request") + return + } + + resp, err := client.ListByTriggerSender(req) + if err != nil { + result.rtlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "ListByTrigger", resp, "Failure sending request") + return + } + + result.rtlr, err = client.ListByTriggerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "ListByTrigger", resp, "Failure responding to request") + } + + return +} + +// ListByTriggerPreparer prepares the ListByTrigger request. +func (client RerunTriggersClient) ListByTriggerPreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "factoryName": autorest.Encode("path", factoryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "triggerName": autorest.Encode("path", triggerName), + } + + const APIVersion = "2018-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/rerunTriggers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByTriggerSender sends the ListByTrigger request. The method will close the +// http.Response Body if it receives an error. +func (client RerunTriggersClient) ListByTriggerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByTriggerResponder handles the response to the ListByTrigger request. The method always +// closes the http.Response Body. +func (client RerunTriggersClient) ListByTriggerResponder(resp *http.Response) (result RerunTriggerListResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByTriggerNextResults retrieves the next set of results, if any. +func (client RerunTriggersClient) listByTriggerNextResults(lastResults RerunTriggerListResponse) (result RerunTriggerListResponse, err error) { + req, err := lastResults.rerunTriggerListResponsePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "listByTriggerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByTriggerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "listByTriggerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByTriggerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "listByTriggerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByTriggerComplete enumerates all values, automatically crossing page boundaries as required. +func (client RerunTriggersClient) ListByTriggerComplete(ctx context.Context, resourceGroupName string, factoryName string, triggerName string) (result RerunTriggerListResponseIterator, err error) { + result.page, err = client.ListByTrigger(ctx, resourceGroupName, factoryName, triggerName) + return +} + +// Start starts a trigger. +// Parameters: +// resourceGroupName - the resource group name. +// factoryName - the factory name. +// triggerName - the trigger name. +// rerunTriggerName - the rerun trigger name. +func (client RerunTriggersClient) Start(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, rerunTriggerName string) (result RerunTriggersStartFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: factoryName, + Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, + {TargetValue: triggerName, + Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, + {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}, + {TargetValue: rerunTriggerName, + Constraints: []validation.Constraint{{Target: "rerunTriggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, + {Target: "rerunTriggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "rerunTriggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datafactory.RerunTriggersClient", "Start", err.Error()) + } + + req, err := client.StartPreparer(ctx, resourceGroupName, factoryName, triggerName, rerunTriggerName) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client RerunTriggersClient) StartPreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, rerunTriggerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "factoryName": autorest.Encode("path", factoryName), + "rerunTriggerName": autorest.Encode("path", rerunTriggerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "triggerName": autorest.Encode("path", triggerName), + } + + const APIVersion = "2018-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/rerunTriggers/{rerunTriggerName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client RerunTriggersClient) StartSender(req *http.Request) (future RerunTriggersStartFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client RerunTriggersClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stops a trigger. +// Parameters: +// resourceGroupName - the resource group name. +// factoryName - the factory name. +// triggerName - the trigger name. +// rerunTriggerName - the rerun trigger name. +func (client RerunTriggersClient) Stop(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, rerunTriggerName string) (result RerunTriggersStopFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: factoryName, + Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}, + {TargetValue: triggerName, + Constraints: []validation.Constraint{{Target: "triggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, + {Target: "triggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "triggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}, + {TargetValue: rerunTriggerName, + Constraints: []validation.Constraint{{Target: "rerunTriggerName", Name: validation.MaxLength, Rule: 260, Chain: nil}, + {Target: "rerunTriggerName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "rerunTriggerName", Name: validation.Pattern, Rule: `^[A-Za-z0-9_][^<>*#.%&:\\+?/]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datafactory.RerunTriggersClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, resourceGroupName, factoryName, triggerName, rerunTriggerName) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.RerunTriggersClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client RerunTriggersClient) StopPreparer(ctx context.Context, resourceGroupName string, factoryName string, triggerName string, rerunTriggerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "factoryName": autorest.Encode("path", factoryName), + "rerunTriggerName": autorest.Encode("path", rerunTriggerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "triggerName": autorest.Encode("path", triggerName), + } + + const APIVersion = "2018-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/rerunTriggers/{rerunTriggerName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client RerunTriggersClient) StopSender(req *http.Request) (future RerunTriggersStopFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client RerunTriggersClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +}