Beispiel #1
0
        /// <summary>
        /// Convert a JobAgent to AzureSqlDatabaseAgentJobExecutionModel
        /// </summary>
        /// <param name="resourceGroupName">The resource group the server is in</param>
        /// <param name="serverName">The server the agent is in</param>
        /// <param name="resp">The management client server response to convert</param>
        /// <returns>The converted agent model</returns>
        private static AzureSqlElasticJobExecutionModel CreateJobExecutionModelFromResponse(
            string resourceGroupName,
            string serverName,
            string agentName,
            string jobName,
            JobExecution resp)
        {
            AzureSqlElasticJobExecutionModel jobExecution = new AzureSqlElasticJobExecutionModel
            {
                ResourceGroupName       = resourceGroupName,
                ServerName              = serverName,
                AgentName               = agentName,
                JobName                 = jobName,
                JobExecutionId          = resp.JobExecutionId,
                CreateTime              = resp.CreateTime,
                CurrentAttempts         = resp.CurrentAttempts,
                CurrentAttemptStartTime = resp.CurrentAttemptStartTime,
                EndTime                 = resp.EndTime,
                JobVersion              = resp.JobVersion,
                LastMessage             = resp.LastMessage,
                Lifecycle               = resp.Lifecycle,
                ProvisioningState       = resp.ProvisioningState,
                ResourceId              = resp.Id,
                StartTime               = resp.StartTime,
                Type = resp.Type,
            };

            return(jobExecution);
        }
Beispiel #2
0
        /// <summary>
        /// Generates the model from user input.
        /// </summary>
        /// <param name="model">This is null since the job execuution doesn't exist yet</param>
        /// <returns>The generated model from user input</returns>
        protected override IEnumerable <AzureSqlElasticJobExecutionModel> ApplyUserInputToModel(IEnumerable <AzureSqlElasticJobExecutionModel> model)
        {
            AzureSqlElasticJobExecutionModel updatedModel = new AzureSqlElasticJobExecutionModel
            {
                ResourceGroupName = this.ResourceGroupName,
                ServerName        = this.ServerName,
                AgentName         = this.AgentName,
                JobName           = this.JobName
            };

            return(new List <AzureSqlElasticJobExecutionModel> {
                updatedModel
            });
        }
Beispiel #3
0
 /// <summary>
 /// Cancels a job execution
 /// </summary>
 /// <param name="resourceGroupName">The resource group name</param>
 /// <param name="serverName">The server the agents are in</param>
 /// <returns>The converted agent model(s)</returns>
 public void CancelJobExecution(AzureSqlElasticJobExecutionModel model)
 {
     Communicator.CancelJobExecution(model.ResourceGroupName, model.ServerName, model.AgentName, model.JobName, model.JobExecutionId.Value);
 }
Beispiel #4
0
        /// <summary>
        /// Creates a root job execution
        /// </summary>
        /// <param name="model"></param>
        /// <returns>The created root job execution</returns>
        public AzureSqlElasticJobExecutionModel BeginCreateJobExecution(AzureSqlElasticJobExecutionModel model)
        {
            var resp = Communicator.BeginCreate(model.ResourceGroupName, model.ServerName, model.AgentName, model.JobName);

            return(CreateJobExecutionModelFromResponse(model.ResourceGroupName, model.ServerName, model.AgentName, model.JobName, resp));
        }