Ejemplo n.º 1
0
        public override void ExecuteCmdlet()
        {
            string status = string.Empty;

            WriteObject(SMClient.CreateStorageJob(new PSCreateJobParams
            {
                Region                    = Location,
                JobCollectionName         = JobCollectionName,
                JobName                   = JobName,
                StorageAccount            = StorageQueueAccount,
                QueueName                 = StorageQueueName,
                SasToken                  = SASToken,
                StorageQueueMessage       = StorageQueueMessage,
                StartTime                 = StartTime,
                Interval                  = Interval,
                Frequency                 = Frequency,
                EndTime                   = EndTime,
                ExecutionCount            = ExecutionCount,
                JobState                  = JobState,
                ErrorActionMethod         = ErrorActionMethod,
                ErrorActionBody           = ErrorActionRequestBody,
                ErrorActionHeaders        = ErrorActionHeaders,
                ErrorActionUri            = ErrorActionURI,
                ErrorActionStorageAccount = ErrorActionStorageAccount,
                ErrorActionQueueName      = ErrorActionStorageQueue,
                ErrorActionQueueBody      = ErrorActionQueueMessageBody,
                ErrorActionSasToken       = ErrorActionSASToken
            }, out status), true);
        }
        public override void ExecuteCmdlet()
        {
            string status = string.Empty;

            if (!SMClient.GetAvailableRegions().Contains(Location, StringComparer.OrdinalIgnoreCase))
            {
                throw new Exception(Resources.SchedulerInvalidLocation);
            }
            else
            {
                WriteObject(SMClient.CreateStorageJob(new PSCreateJobParams
                {
                    Region                    = Location,
                    JobCollectionName         = JobCollectionName,
                    JobName                   = JobName,
                    StorageAccount            = StorageQueueAccount,
                    QueueName                 = StorageQueueName,
                    SasToken                  = SASToken,
                    StorageQueueMessage       = StorageQueueMessage,
                    StartTime                 = StartTime,
                    Interval                  = Interval,
                    Frequency                 = Frequency,
                    EndTime                   = EndTime,
                    ExecutionCount            = ExecutionCount,
                    JobState                  = JobState,
                    ErrorActionMethod         = ErrorActionMethod,
                    ErrorActionBody           = ErrorActionRequestBody,
                    ErrorActionHeaders        = ErrorActionHeaders,
                    ErrorActionUri            = ErrorActionURI,
                    ErrorActionStorageAccount = ErrorActionStorageAccount,
                    ErrorActionQueueName      = ErrorActionStorageQueue,
                    ErrorActionQueueBody      = ErrorActionQueueMessageBody,
                    ErrorActionSasToken       = ErrorActionSASToken
                }, out status), true);
            }
        }