Skip to content

Commit

Permalink
Generated from 814795cce5766e56d08e877d7f359c2d6380a8be (Azure#4676)
Browse files Browse the repository at this point in the history
update example
  • Loading branch information
openapi-sdkautomation[bot] authored and SDK Automation committed Aug 15, 2019
1 parent aa949ac commit fda7241
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
@JsonSubTypes.Type(name = "SalesforceServiceCloudSource", value = SalesforceServiceCloudSource.class),
@JsonSubTypes.Type(name = "SalesforceSource", value = SalesforceSource.class),
@JsonSubTypes.Type(name = "ODataSource", value = ODataSource.class),
@JsonSubTypes.Type(name = "SapBwSource", value = SapBwSource.class),
@JsonSubTypes.Type(name = "SybaseSource", value = SybaseSource.class),
@JsonSubTypes.Type(name = "PostgreSqlSource", value = PostgreSqlSource.class),
@JsonSubTypes.Type(name = "MySqlSource", value = MySqlSource.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,25 @@

package com.microsoft.azure.management.datafactory.v2018_06_01;

import rx.Completable;
import rx.Observable;
import com.microsoft.azure.management.datafactory.v2018_06_01.implementation.TriggerRunsInner;
import com.microsoft.azure.arm.model.HasInner;

/**
* Type representing TriggerRuns.
*/
public interface TriggerRuns extends HasInner<TriggerRunsInner> {
public interface TriggerRuns {
/**
* Rerun single trigger instance by runId.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param triggerName The trigger name.
* @param runId The pipeline run identifier.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
Completable rerunAsync(String resourceGroupName, String factoryName, String triggerName, String runId);

/**
* Query trigger runs.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,29 +289,29 @@ public TriggersInner triggers() {
}

/**
* The RerunTriggersInner object to access its operations.
* The TriggerRunsInner object to access its operations.
*/
private RerunTriggersInner rerunTriggers;
private TriggerRunsInner triggerRuns;

/**
* Gets the RerunTriggersInner object to access its operations.
* @return the RerunTriggersInner object.
* Gets the TriggerRunsInner object to access its operations.
* @return the TriggerRunsInner object.
*/
public RerunTriggersInner rerunTriggers() {
return this.rerunTriggers;
public TriggerRunsInner triggerRuns() {
return this.triggerRuns;
}

/**
* The TriggerRunsInner object to access its operations.
* The RerunTriggersInner object to access its operations.
*/
private TriggerRunsInner triggerRuns;
private RerunTriggersInner rerunTriggers;

/**
* Gets the TriggerRunsInner object to access its operations.
* @return the TriggerRunsInner object.
* Gets the RerunTriggersInner object to access its operations.
* @return the RerunTriggersInner object.
*/
public TriggerRunsInner triggerRuns() {
return this.triggerRuns;
public RerunTriggersInner rerunTriggers() {
return this.rerunTriggers;
}

/**
Expand Down Expand Up @@ -361,8 +361,8 @@ protected void initialize() {
this.pipelineRuns = new PipelineRunsInner(restClient().retrofit(), this);
this.activityRuns = new ActivityRunsInner(restClient().retrofit(), this);
this.triggers = new TriggersInner(restClient().retrofit(), this);
this.rerunTriggers = new RerunTriggersInner(restClient().retrofit(), this);
this.triggerRuns = new TriggerRunsInner(restClient().retrofit(), this);
this.rerunTriggers = new RerunTriggersInner(restClient().retrofit(), this);
this.azureClient = new AzureClient(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import com.microsoft.azure.management.datafactory.v2018_06_01.PipelineRuns;
import com.microsoft.azure.management.datafactory.v2018_06_01.ActivityRuns;
import com.microsoft.azure.management.datafactory.v2018_06_01.Triggers;
import com.microsoft.azure.management.datafactory.v2018_06_01.RerunTriggers;
import com.microsoft.azure.management.datafactory.v2018_06_01.TriggerRuns;
import com.microsoft.azure.management.datafactory.v2018_06_01.RerunTriggers;
import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl;
import com.microsoft.azure.arm.resources.implementation.ManagerCore;

Expand All @@ -49,8 +49,8 @@ public final class DataFactoryManager extends ManagerCore<DataFactoryManager, Da
private PipelineRuns pipelineRuns;
private ActivityRuns activityRuns;
private Triggers triggers;
private RerunTriggers rerunTriggers;
private TriggerRuns triggerRuns;
private RerunTriggers rerunTriggers;
/**
* Get a Configurable instance that can be used to create DataFactoryManager with optional configuration.
*
Expand Down Expand Up @@ -218,16 +218,6 @@ public Triggers triggers() {
return this.triggers;
}

/**
* @return Entry point to manage RerunTriggers.
*/
public RerunTriggers rerunTriggers() {
if (this.rerunTriggers == null) {
this.rerunTriggers = new RerunTriggersImpl(this);
}
return this.rerunTriggers;
}

/**
* @return Entry point to manage TriggerRuns.
*/
Expand All @@ -238,6 +228,16 @@ public TriggerRuns triggerRuns() {
return this.triggerRuns;
}

/**
* @return Entry point to manage RerunTriggers.
*/
public RerunTriggers rerunTriggers() {
if (this.rerunTriggers == null) {
this.rerunTriggers = new RerunTriggersImpl(this);
}
return this.rerunTriggers;
}

/**
* The implementation for Configurable interface.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
@JsonSubTypes.Type(name = "SapHanaTable", value = SapHanaTableDataset.class),
@JsonSubTypes.Type(name = "SapEccResource", value = SapEccResourceDataset.class),
@JsonSubTypes.Type(name = "SapCloudForCustomerResource", value = SapCloudForCustomerResourceDataset.class),
@JsonSubTypes.Type(name = "SapBwCube", value = SapBwCubeDataset.class),
@JsonSubTypes.Type(name = "SybaseTable", value = SybaseTableDataset.class),
@JsonSubTypes.Type(name = "SalesforceServiceCloudObject", value = SalesforceServiceCloudObjectDataset.class),
@JsonSubTypes.Type(name = "SalesforceObject", value = SalesforceObjectDataset.class),
@JsonSubTypes.Type(name = "MicrosoftAccessTable", value = MicrosoftAccessTableDataset.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import com.microsoft.azure.management.datafactory.v2018_06_01.TriggerRuns;
import rx.Completable;
import rx.functions.Func1;
import rx.Observable;
import com.microsoft.azure.management.datafactory.v2018_06_01.TriggerRunsQueryResponse;
Expand All @@ -28,6 +29,12 @@ public DataFactoryManager manager() {
return this.manager;
}

@Override
public Completable rerunAsync(String resourceGroupName, String factoryName, String triggerName, String runId) {
TriggerRunsInner client = this.inner();
return client.rerunAsync(resourceGroupName, factoryName, triggerName, runId).toCompletable();
}

@Override
public Observable<TriggerRunsQueryResponse> queryByFactoryAsync(String resourceGroupName, String factoryName, RunFilterParameters filterParameters) {
TriggerRunsInner client = this.inner();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,115 @@ public TriggerRunsInner(Retrofit retrofit, DataFactoryManagementClientImpl clien
* used by Retrofit to perform actually REST calls.
*/
interface TriggerRunsService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2018_06_01.TriggerRuns rerun" })
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/triggerRuns/{runId}/rerun")
Observable<Response<ResponseBody>> rerun(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("triggerName") String triggerName, @Path("runId") String runId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2018_06_01.TriggerRuns queryByFactory" })
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/queryTriggerRuns")
Observable<Response<ResponseBody>> queryByFactory(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Query("api-version") String apiVersion, @Body RunFilterParameters filterParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

}

/**
* Rerun single trigger instance by runId.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param triggerName The trigger name.
* @param runId The pipeline run identifier.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
*/
public void rerun(String resourceGroupName, String factoryName, String triggerName, String runId) {
rerunWithServiceResponseAsync(resourceGroupName, factoryName, triggerName, runId).toBlocking().single().body();
}

/**
* Rerun single trigger instance by runId.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param triggerName The trigger name.
* @param runId The pipeline run identifier.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<Void> rerunAsync(String resourceGroupName, String factoryName, String triggerName, String runId, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(rerunWithServiceResponseAsync(resourceGroupName, factoryName, triggerName, runId), serviceCallback);
}

/**
* Rerun single trigger instance by runId.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param triggerName The trigger name.
* @param runId The pipeline run identifier.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<Void> rerunAsync(String resourceGroupName, String factoryName, String triggerName, String runId) {
return rerunWithServiceResponseAsync(resourceGroupName, factoryName, triggerName, runId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}

/**
* Rerun single trigger instance by runId.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param triggerName The trigger name.
* @param runId The pipeline run identifier.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<ServiceResponse<Void>> rerunWithServiceResponseAsync(String resourceGroupName, String factoryName, String triggerName, String runId) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (factoryName == null) {
throw new IllegalArgumentException("Parameter factoryName is required and cannot be null.");
}
if (triggerName == null) {
throw new IllegalArgumentException("Parameter triggerName is required and cannot be null.");
}
if (runId == null) {
throw new IllegalArgumentException("Parameter runId is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.rerun(this.client.subscriptionId(), resourceGroupName, factoryName, triggerName, runId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = rerunDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

private ServiceResponse<Void> rerunDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<Void>() { }.getType())
.registerError(CloudException.class)
.build(response);
}

/**
* Query trigger runs.
*
Expand Down

0 comments on commit fda7241

Please sign in to comment.