/// <summary> /// This method gets all the job definitions of the given data manager /// resource. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='nextPageLink'> /// The NextLink from the previous successful call to List operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IPage <JobDefinition> > ListByDataManagerNextAsync(this IJobDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByDataManagerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// This method gets all the job definitions of the given data service name. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='dataServiceName'> /// The data service type of interest. /// </param> /// <param name='resourceGroupName'> /// The Resource Group Name /// </param> /// <param name='dataManagerName'> /// The name of the DataManager Resource within the specified resource group. /// DataManager names must be between 3 and 24 characters in length and use any /// alphanumeric and underscore only /// </param> /// <param name='odataQuery'> /// OData parameters to apply to the operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IPage <JobDefinition> > ListByDataServiceAsync(this IJobDefinitionsOperations operations, string dataServiceName, string resourceGroupName, string dataManagerName, ODataQuery <JobDefinitionFilter> odataQuery = default(ODataQuery <JobDefinitionFilter>), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByDataServiceWithHttpMessagesAsync(dataServiceName, resourceGroupName, dataManagerName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public static JobDefinition GetJobDefinition(this IJobDefinitionsOperations operations, HybridDataManagementClient client, string dataSourceName, string dataSinkName, string resourceGroupName, string dataManagerName, string runLocation, UserConfirmation userConfirmation, string deviceName, string containerName, string[] volumeNames, BackupChoice backupChoice, string fileNameFilter = null, string[] rootDirectories = null, AzureStorageType azureStorageType = AzureStorageType.Blob, bool isDirectoryMode = false) { var jobDefinition = new JobDefinition(); jobDefinition.DataSinkId = client.DataStores.Get(dataStoreName: dataSinkName, resourceGroupName: resourceGroupName, dataManagerName: dataManagerName).Id; jobDefinition.DataSourceId = client.DataStores.Get(dataStoreName: dataSourceName, resourceGroupName: resourceGroupName, dataManagerName: dataManagerName).Id; RunLocation parsedRunLocation = RunLocation.None; if (Enum.TryParse(runLocation, true, out parsedRunLocation)) { jobDefinition.RunLocation = parsedRunLocation; } jobDefinition.State = State.Enabled; jobDefinition.UserConfirmation = userConfirmation; jobDefinition.DataServiceInput = GetDataServiceInput(deviceName, containerName, volumeNames, backupChoice, fileNameFilter, rootDirectories, azureStorageType, isDirectoryMode); return(jobDefinition); }
/// <summary> /// Creates or updates a job definition. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='dataServiceName'> /// The data service type of the job definition. /// </param> /// <param name='jobDefinitionName'> /// The job definition name to be created or updated. /// </param> /// <param name='jobDefinition'> /// Job Definition object to be created or updated. /// </param> /// <param name='resourceGroupName'> /// The Resource Group Name /// </param> /// <param name='dataManagerName'> /// The name of the DataManager Resource within the specified resource group. /// DataManager names must be between 3 and 24 characters in length and use any /// alphanumeric and underscore only /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <JobDefinition> BeginCreateOrUpdateAsync(this IJobDefinitionsOperations operations, string dataServiceName, string jobDefinitionName, JobDefinition jobDefinition, string resourceGroupName, string dataManagerName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(dataServiceName, jobDefinitionName, jobDefinition, resourceGroupName, dataManagerName, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// This method runs a job instance of the given job definition and returns the jobId. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='dataServiceName'> /// The data service type of the job definition. /// </param> /// <param name='jobDefinitionName'> /// Name of the job definition. /// </param> /// <param name='runParameters'> /// Run time parameters for the job definition. /// </param> /// <param name='resourceGroupName'> /// The Resource Group Name /// </param> /// <param name='dataManagerName'> /// The name of the DataManager Resource within the specified resource group. /// DataManager names must be between 3 and 24 characters in length and use any /// alphanumeric and underscore only /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param>The jobId of the triggered job<returns></returns> public static string BeginRunAndGetJobId(this IJobDefinitionsOperations operations, string dataServiceName, string jobDefinitionName, RunParameters runParameters, string resourceGroupName, string dataManagerName, CancellationToken cancellationToken = default(CancellationToken)) { var result = operations.BeginRunWithHttpMessagesAsync(dataServiceName, jobDefinitionName, runParameters, resourceGroupName, dataManagerName).GetAwaiter().GetResult(); string jobId = result == null ? String.Empty : result.Response.Headers.Location.AbsolutePath.Split('/').Last() .Split('?').First(); return(jobId); }
public static RunParameters GetRunParameters(this IJobDefinitionsOperations operations, HybridDataManagementClient client, string jobDefinitionName, string dataServiceName, string dataManagerName, string resourceGroupName, UserConfirmation userConfirmation, string deviceName = null, string containerName = null, string[] volumeNames = null, BackupChoice backupChoice = BackupChoice.UseExistingLatest, string fileNameFilter = null, string[] rootDirectories = null, string azureStorageType = null, bool isDirectoryMode = false) { RunParameters runParameters = new RunParameters(); runParameters.CustomerSecrets = new List <CustomerSecret>(); runParameters.UserConfirmation = userConfirmation; //JToken dataServiceInputJToken = client.JobDefinitions.Get(dataServiceName: dataServiceName, JToken dataServiceInputJToken = operations.Get(dataServiceName: dataServiceName, jobDefinitionName: jobDefinitionName, resourceGroupName: resourceGroupName, dataManagerName: dataManagerName).DataServiceInput as JToken; dataServiceInputJToken["DeviceName"] = deviceName ?? dataServiceInputJToken["DeviceName"]; dataServiceInputJToken["FileNameFilter"] = fileNameFilter ?? dataServiceInputJToken["FileNameFilter"]; dataServiceInputJToken["ContainerName"] = containerName ?? dataServiceInputJToken["ContainerName"]; if (rootDirectories != null) { JArray rootDirectoriesObj = new JArray(); foreach (var rootDirectory in rootDirectories) { rootDirectoriesObj.Add(rootDirectory); } dataServiceInputJToken["RootDirectories"] = rootDirectoriesObj; } if (volumeNames != null) { JArray volumeNamesObj = new JArray(); foreach (var volumeName in volumeNames) { volumeNamesObj.Add(volumeName); } dataServiceInputJToken["VolumeNames"] = volumeNamesObj; } dataServiceInputJToken["BackupChoice"] = backupChoice.ToString() ?? dataServiceInputJToken["BackupChoice"]; dataServiceInputJToken["IsDirectoryMode"] = isDirectoryMode; dataServiceInputJToken["AzureStorageType"] = azureStorageType ?? dataServiceInputJToken["AzureStorageType"]; runParameters.DataServiceInput = dataServiceInputJToken; return(runParameters); }
/// <summary> /// This method gets all the job definitions of the given data manager /// resource. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='nextPageLink'> /// The NextLink from the previous successful call to List operation. /// </param> public static IPage <JobDefinition> ListByDataManagerNext(this IJobDefinitionsOperations operations, string nextPageLink) { return(operations.ListByDataManagerNextAsync(nextPageLink).GetAwaiter().GetResult()); }
/// <summary> /// This method runs a job instance of the given job definition. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='dataServiceName'> /// The data service type of the job definition. /// </param> /// <param name='jobDefinitionName'> /// Name of the job definition. /// </param> /// <param name='runParameters'> /// Run time parameters for the job definition. /// </param> /// <param name='resourceGroupName'> /// The Resource Group Name /// </param> /// <param name='dataManagerName'> /// The name of the DataManager Resource within the specified resource group. /// DataManager names must be between 3 and 24 characters in length and use any /// alphanumeric and underscore only /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task BeginRunAsync(this IJobDefinitionsOperations operations, string dataServiceName, string jobDefinitionName, RunParameters runParameters, string resourceGroupName, string dataManagerName, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.BeginRunWithHttpMessagesAsync(dataServiceName, jobDefinitionName, runParameters, resourceGroupName, dataManagerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// This method runs a job instance of the given job definition. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='dataServiceName'> /// The data service type of the job definition. /// </param> /// <param name='jobDefinitionName'> /// Name of the job definition. /// </param> /// <param name='runParameters'> /// Run time parameters for the job definition. /// </param> /// <param name='resourceGroupName'> /// The Resource Group Name /// </param> /// <param name='dataManagerName'> /// The name of the DataManager Resource within the specified resource group. /// DataManager names must be between 3 and 24 characters in length and use any /// alphanumeric and underscore only /// </param> public static void BeginRun(this IJobDefinitionsOperations operations, string dataServiceName, string jobDefinitionName, RunParameters runParameters, string resourceGroupName, string dataManagerName) { operations.BeginRunAsync(dataServiceName, jobDefinitionName, runParameters, resourceGroupName, dataManagerName).GetAwaiter().GetResult(); }
/// <summary> /// This method gets all the job definitions of the given data service name. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='dataServiceName'> /// The data service type of interest. /// </param> /// <param name='resourceGroupName'> /// The Resource Group Name /// </param> /// <param name='dataManagerName'> /// The name of the DataManager Resource within the specified resource group. /// DataManager names must be between 3 and 24 characters in length and use any /// alphanumeric and underscore only /// </param> /// <param name='odataQuery'> /// OData parameters to apply to the operation. /// </param> public static IPage <JobDefinition> ListByDataService(this IJobDefinitionsOperations operations, string dataServiceName, string resourceGroupName, string dataManagerName, ODataQuery <JobDefinitionFilter> odataQuery = default(ODataQuery <JobDefinitionFilter>)) { return(operations.ListByDataServiceAsync(dataServiceName, resourceGroupName, dataManagerName, odataQuery).GetAwaiter().GetResult()); }
/// <summary> /// Creates or updates a job definition. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='dataServiceName'> /// The data service type of the job definition. /// </param> /// <param name='jobDefinitionName'> /// The job definition name to be created or updated. /// </param> /// <param name='jobDefinition'> /// Job Definition object to be created or updated. /// </param> /// <param name='resourceGroupName'> /// The Resource Group Name /// </param> /// <param name='dataManagerName'> /// The name of the DataManager Resource within the specified resource group. /// DataManager names must be between 3 and 24 characters in length and use any /// alphanumeric and underscore only /// </param> public static JobDefinition BeginCreateOrUpdate(this IJobDefinitionsOperations operations, string dataServiceName, string jobDefinitionName, JobDefinition jobDefinition, string resourceGroupName, string dataManagerName) { return(operations.BeginCreateOrUpdateAsync(dataServiceName, jobDefinitionName, jobDefinition, resourceGroupName, dataManagerName).GetAwaiter().GetResult()); }
/// <summary> /// This method deletes the given job definition. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='dataServiceName'> /// The data service type of the job definition. /// </param> /// <param name='jobDefinitionName'> /// The job definition name to be deleted. /// </param> /// <param name='resourceGroupName'> /// The Resource Group Name /// </param> /// <param name='dataManagerName'> /// The name of the DataManager Resource within the specified resource group. /// DataManager names must be between 3 and 24 characters in length and use any /// alphanumeric and underscore only /// </param> public static void Delete(this IJobDefinitionsOperations operations, string dataServiceName, string jobDefinitionName, string resourceGroupName, string dataManagerName) { operations.DeleteAsync(dataServiceName, jobDefinitionName, resourceGroupName, dataManagerName).GetAwaiter().GetResult(); }
/// <summary> /// This method gets job definition object by name. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='dataServiceName'> /// The data service name of the job definition /// </param> /// <param name='jobDefinitionName'> /// The job definition name that is being queried. /// </param> /// <param name='resourceGroupName'> /// The Resource Group Name /// </param> /// <param name='dataManagerName'> /// The name of the DataManager Resource within the specified resource group. /// DataManager names must be between 3 and 24 characters in length and use any /// alphanumeric and underscore only /// </param> public static JobDefinition Get(this IJobDefinitionsOperations operations, string dataServiceName, string jobDefinitionName, string resourceGroupName, string dataManagerName) { return(operations.GetAsync(dataServiceName, jobDefinitionName, resourceGroupName, dataManagerName).GetAwaiter().GetResult()); }