/// <summary> /// Get job action. /// </summary> /// <param name="updateJobActionParams">Job action properties specified via PowerShell.</param> /// <param name="existingJobAction">Job action properties from existing job.</param> /// <returns>JobAction object.</returns> private JobAction GetExistingJobAction(PSJobActionParams updateJobActionParams, JobAction existingJobAction) { if (updateJobActionParams != null) { if (existingJobAction != null && (existingJobAction.Type == updateJobActionParams.JobActionType || ((existingJobAction.Type == JobActionType.Http || existingJobAction.Type == JobActionType.Https) && (updateJobActionParams.JobActionType == JobActionType.Http || updateJobActionParams.JobActionType == JobActionType.Https)))) { switch (updateJobActionParams.JobActionType) { case JobActionType.Http: case JobActionType.Https: PSHttpJobActionParams httpJobAction = updateJobActionParams.HttpJobAction; HttpRequest existinghHttpRequest = existingJobAction.Request; if (httpJobAction.Uri != null) { existinghHttpRequest.Uri = httpJobAction.Uri.OriginalString; existingJobAction.Type = updateJobActionParams.JobActionType; } existinghHttpRequest.Method = httpJobAction.RequestMethod.GetValueOrDefault(defaultValue: existinghHttpRequest.Method); existinghHttpRequest.Body = httpJobAction.RequestBody.GetValueOrDefault(defaultValue: existinghHttpRequest.Body); existinghHttpRequest.Headers = httpJobAction.RequestHeaders != null?httpJobAction.RequestHeaders.ToDictionary() : existinghHttpRequest.Headers; existinghHttpRequest.Authentication = this.GetExistingAuthentication(httpJobAction.RequestAuthentication, existinghHttpRequest.Authentication); break; case JobActionType.StorageQueue: PSStorageJobActionParams storageJobAction = updateJobActionParams.StorageJobAction; StorageQueueMessage existingStorageQueue = existingJobAction.QueueMessage; storageJobAction.StorageAccount = storageJobAction.StorageAccount.GetValueOrDefault(defaultValue: existingStorageQueue.StorageAccount); storageJobAction.StorageQueueMessage = storageJobAction.StorageQueueMessage.GetValueOrDefault(defaultValue: existingStorageQueue.Message); storageJobAction.StorageQueueName = storageJobAction.StorageQueueName.GetValueOrDefault(defaultValue: existingStorageQueue.QueueName); storageJobAction.StorageSasToken = storageJobAction.StorageSasToken.GetValueOrDefault(defaultValue: existingStorageQueue.SasToken); break; case JobActionType.ServiceBusQueue: PSServiceBusParams serviceBusQueueParams = updateJobActionParams.ServiceBusAction; ServiceBusQueueMessage existingServiceBusQueueMessage = existingJobAction.ServiceBusQueueMessage; this.UpdateServiceBus(serviceBusQueueParams, existingServiceBusQueueMessage); existingServiceBusQueueMessage.QueueName = serviceBusQueueParams.QueueName.GetValueOrDefault(defaultValue: existingServiceBusQueueMessage.QueueName); break; case JobActionType.ServiceBusTopic: PSServiceBusParams serviceBusTopicParams = updateJobActionParams.ServiceBusAction; ServiceBusTopicMessage existingServiceBusTopicMessage = existingJobAction.ServiceBusTopicMessage; this.UpdateServiceBus(serviceBusTopicParams, existingServiceBusTopicMessage); existingServiceBusTopicMessage.TopicPath = serviceBusTopicParams.TopicPath.GetValueOrDefault(defaultValue: existingServiceBusTopicMessage.TopicPath); break; } } else { this.PopulateJobAction(updateJobActionParams, ref existingJobAction); } } return(existingJobAction); }
/// <summary> /// Gets Service bus queue. /// </summary> /// <param name="serviceBusQueueActionParams">Service bus queue action propertis specified via PowerShell.</param> /// <returns>serviceBusQueueMessage object.</returns> private ServiceBusQueueMessage GetServiceBusQueue(PSServiceBusParams serviceBusQueueActionParams) { if (string.IsNullOrWhiteSpace(serviceBusQueueActionParams.QueueName)) { throw new PSManagement.PSArgumentException(Resources.SchedulerInvalidServiceBusQueueName); } var serviceBusQueueMessage = new ServiceBusQueueMessage() { QueueName = serviceBusQueueActionParams.QueueName }; this.PopulateServiceBusMessage(serviceBusQueueActionParams, serviceBusQueueMessage); return(serviceBusQueueMessage); }
/// <summary> /// Gets service bus queue job action details. /// </summary> /// <param name="jobActionType">Job action type.</param> /// <param name="storageQueue">Stervice bus queue message.</param> /// <returns>PSServiceBusJobActionDetails.</returns> internal static PSServiceBusJobActionDetails GetSchedulerServiceBusQueueJobActionDetails(JobActionType jobActionType, ServiceBusQueueMessage serviceBusQueueMessage) { var psServiceBusjobActionDetails = Converter.GetServiceBusJobActionDetails(jobActionType, serviceBusQueueMessage); psServiceBusjobActionDetails.ServiceBusQueueName = serviceBusQueueMessage.QueueName; return psServiceBusjobActionDetails; }
/// <summary> /// Gets service bus queue job action details. /// </summary> /// <param name="jobActionType">Job action type.</param> /// <param name="storageQueue">Stervice bus queue message.</param> /// <returns>PSServiceBusJobActionDetails.</returns> internal static PSServiceBusJobActionDetails GetSchedulerServiceBusQueueJobActionDetails(JobActionType jobActionType, ServiceBusQueueMessage serviceBusQueueMessage) { var psServiceBusjobActionDetails = Converter.GetServiceBusJobActionDetails(jobActionType, serviceBusQueueMessage); psServiceBusjobActionDetails.ServiceBusQueueName = serviceBusQueueMessage.QueueName; return(psServiceBusjobActionDetails); }
/// <summary> /// Gets Service bus queue. /// </summary> /// <param name="serviceBusQueueActionParams">Service bus queue action propertis specified via PowerShell.</param> /// <returns>serviceBusQueueMessage object.</returns> private ServiceBusQueueMessage GetServiceBusQueue(PSServiceBusParams serviceBusQueueActionParams) { if (string.IsNullOrWhiteSpace(serviceBusQueueActionParams.QueueName)) { throw new PSManagement.PSArgumentException(Resources.SchedulerInvalidServiceBusQueueName); } var serviceBusQueueMessage = new ServiceBusQueueMessage() { QueueName = serviceBusQueueActionParams.QueueName }; this.PopulateServiceBusMessage(serviceBusQueueActionParams, serviceBusQueueMessage); return serviceBusQueueMessage; }