/// <summary>
        /// Executes the command.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            var httpJobAction = new PSHttpJobActionParams()
            {
                RequestMethod = this.Method,
                Uri = this.Uri,
                RequestBody = this.RequestBody,
                RequestHeaders = this.Headers,
                RequestAuthentication = GetAuthenticationParams(),
            };

            JobActionType jobActionType;

            if (this.Uri.Scheme.Equals(Constants.HttpScheme, StringComparison.InvariantCultureIgnoreCase) ||
                this.Uri.Scheme.Equals(Constants.HttpsScheme, StringComparison.InvariantCultureIgnoreCase))
            {
                jobActionType = (JobActionType)Enum.Parse(typeof(JobActionType), this.Uri.Scheme, ignoreCase: true);
            }
            else
            {
                throw new PSArgumentException(string.Format(Resources.SchedulerInvalidUriScheme, this.Uri.Scheme));
            }

            var jobAction = new PSJobActionParams()
            {
                JobActionType = jobActionType,
                HttpJobAction = httpJobAction
            };

            var jobRecurrence = new PSJobRecurrenceParams()
            {
                Interval = this.Interval,
                Frequency = this.Frequency,
                EndTime = this.EndTime,
                ExecutionCount = this.ExecutionCount
            };

            var jobParams = new PSJobParams()
            {
                ResourceGroupName = this.ResourceGroupName,
                JobCollectionName = this.JobCollectionName,
                JobName = this.JobName,
                JobState = this.JobState,
                StartTime = this.StartTime,
                JobAction = jobAction,
                JobRecurrence = jobRecurrence,
                JobErrorAction = this.GetErrorActionParamsValue(this.ErrorActionType)
            };

            this.ConfirmAction(
                processMessage: string.Format(Resources.NewHttpJobResourceDescription, this.JobName),
                target: this.JobCollectionName,
                action: () =>
                    {
                        this.WriteObject(this.SchedulerClient.CreateJob(jobParams));
                    }
            );
        }
        /// <summary>
        /// Executes the command.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            var serviceBusAuthentication = new PSServiceBusAuthenticationParams()
            {
                SasKey = this.ServiceBusSasKeyValue,
                SasKeyName = this.ServiceBusSasKeyName,
                Type = Constants.SharedAccessKey
            };

            var servicBusQueue = new PSServiceBusParams()
            {
                Authentication = serviceBusAuthentication,
                Message = this.ServiceBusMessage,
                NamespaceProperty = this.ServiceBusNamespace,
                QueueName = this.ServiceBusQueueName,
                TransportType = this.ServiceBusTransportType
            };

            var jobAction = new PSJobActionParams()
            {
                JobActionType = SchedulerModels.JobActionType.ServiceBusQueue,
                ServiceBusAction = servicBusQueue
            };

            var jobRecurrence = new PSJobRecurrenceParams()
            {
                Interval = this.Interval,
                Frequency = this.Frequency,
                EndTime = this.EndTime,
                ExecutionCount = this.ExecutionCount
            };

            var jobParams = new PSJobParams()
            {
                ResourceGroupName = this.ResourceGroupName,
                JobCollectionName = this.JobCollectionName,
                JobName = this.JobName,
                JobState = this.JobState,
                StartTime = this.StartTime,
                JobAction = jobAction,
                JobRecurrence = jobRecurrence,
                JobErrorAction = this.GetErrorActionParamsValue(this.ErrorActionType)
            };

            this.ConfirmAction(
                processMessage: string.Format(Resources.NewServiceBusQueueJobResourceDescription, this.JobName),
                target: this.JobCollectionName,
                action: () =>
                {
                    this.WriteObject(this.SchedulerClient.CreateJob(jobParams));
                }
            );
        }
        /// <summary>
        /// Gets existing job recurrence.
        /// </summary>
        /// <param name="updateRecurrenceParams">Recurrence properties specified via PowerShell.</param>
        /// <param name="recurrence">Existing job recurrence property.</param>
        /// <returns>JobRecurrence object.</returns>
        private JobRecurrence GetExistingJobRecurrence(PSJobRecurrenceParams updateRecurrenceParams, JobRecurrence recurrence)
        {
            if (updateRecurrenceParams != null)
            {
                if (recurrence == null)
                {
                    return this.GetJobRecurrence(updateRecurrenceParams);
                }

                recurrence.Count = updateRecurrenceParams.ExecutionCount ?? recurrence.Count;
                recurrence.EndTime = updateRecurrenceParams.EndTime ?? recurrence.EndTime;
                recurrence.Frequency = updateRecurrenceParams.Frequency.GetValueOrDefaultEnum<RecurrenceFrequency?>(defaultValue: recurrence.Frequency);
                recurrence.Interval = updateRecurrenceParams.Interval ?? recurrence.Interval;
            }

            return recurrence;
        }
        /// <summary>
        /// Executes the command.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();
            
            var storageJobAction = new PSStorageJobActionParams()
            {
                StorageAccount = this.StorageQueueAccount,
                StorageQueueMessage = this.StorageQueueMessage,
                StorageQueueName = this.StorageQueueName,
                StorageSasToken = this.StorageSASToken
            };

            var jobAction = new PSJobActionParams()
            {
                JobActionType = SchedulerModels.JobActionType.StorageQueue,
                StorageJobAction = storageJobAction
            };

            var jobRecurrence = new PSJobRecurrenceParams()
            {
                Interval = this.Interval,
                Frequency = this.Frequency,
                EndTime = this.EndTime,
                ExecutionCount = this.ExecutionCount
            };

            var jobParams = new PSJobParams()
            {
                ResourceGroupName = this.ResourceGroupName,
                JobCollectionName = this.JobCollectionName,
                JobName = this.JobName,
                JobState = this.JobState,
                StartTime = this.StartTime,
                JobAction = jobAction,
                JobRecurrence = jobRecurrence,
                JobErrorAction = this.GetErrorActionParamsValue(this.ErrorActionType)
            };

            this.ConfirmAction(
                processMessage: string.Format(Resources.NewStorageQueueJobResourceDescription, this.JobName),
                target: this.JobCollectionName,
                action: () =>
                {
                    this.WriteObject(this.SchedulerClient.CreateJob(jobParams));
                }
            );
        }
        /// <summary>
        /// Gets job recurrence.
        /// </summary>
        /// <param name="jobRecurrenceParams">Job recurrence properties specified via PowerShell.</param>
        /// <returns>JobRecurrence object.</returns>
        private JobRecurrence GetJobRecurrence(PSJobRecurrenceParams jobRecurrenceParams)
        {
            if (jobRecurrenceParams != null &&
               (jobRecurrenceParams.Interval != null ||
                jobRecurrenceParams.ExecutionCount != null ||
                !string.IsNullOrWhiteSpace(jobRecurrenceParams.Frequency) ||
                jobRecurrenceParams.EndTime != null))
            {
                var jobRecurrence = new JobRecurrence()
                {
                    Count = jobRecurrenceParams.ExecutionCount ?? default(int?),
                    Interval = jobRecurrenceParams.Interval ?? default(int?),
                    EndTime = jobRecurrenceParams.EndTime ?? default(DateTime?),
                    Frequency = jobRecurrenceParams.Frequency.GetValueOrDefaultEnum<RecurrenceFrequency?>(defaultValue: null)
                };

                return jobRecurrence;
            }

            return null;
        }