Esempio n. 1
0
 public override void ExecuteCmdlet()
 {
     if (!string.IsNullOrEmpty(Location) && !SMClient.GetAvailableRegions().Contains(Location, StringComparer.OrdinalIgnoreCase))
     {
         throw new Exception(Resources.SchedulerInvalidLocation);
     }
     else
     {
         WriteObject(SMClient.GetJob(region: Location, jobCollection: JobCollectionName, job: JobName, state: JobState), true);
     }
 }
Esempio n. 2
0
 public override void ExecuteCmdlet()
 {
     ConfirmAction(
         Force.IsPresent,
         string.Format(Resources.RemoveJobCollectionWarning, JobCollectionName),
         Resources.RemoveJobCollectionMessage,
         JobCollectionName,
         () =>
     {
         if (!string.IsNullOrEmpty(Location) && !SMClient.GetAvailableRegions().Contains(Location, StringComparer.OrdinalIgnoreCase))
         {
             throw new Exception(Resources.SchedulerInvalidLocation);
         }
         else
         {
             WriteObject(SMClient.DeleteJobCollection(region: Location, jobCollection: JobCollectionName), true);
         }
     });
 }
        public override void ExecuteCmdlet()
        {
            string status = string.Empty;

            if (!SMClient.GetAvailableRegions().Contains(Location, StringComparer.OrdinalIgnoreCase))
            {
                throw new Exception(Resources.SchedulerInvalidLocation);
            }
            else
            {
                WriteObject(SMClient.CreateHttpJob(new PSCreateJobParams
                {
                    Region            = Location,
                    JobCollectionName = JobCollectionName,
                    JobName           = JobName,
                    Method            = Method,
                    Headers           = Headers,
                    Uri                       = URI,
                    Body                      = RequestBody,
                    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);
                WriteObject(status);
            }
        }
 public override void ExecuteCmdlet()
 {
     WriteObject(SMClient.GetAvailableRegions(), true);
 }
Esempio n. 5
0
        public override void ExecuteCmdlet()
        {
            string status = string.Empty;

            if (!SMClient.GetAvailableRegions().Contains(Location, StringComparer.OrdinalIgnoreCase))
            {
                WriteWarning(Resources.SchedulerInvalidLocation);
            }
            else
            {
                if (PassThru.IsPresent)
                {
                    WriteObject(SMClient.PatchStorageJob(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);
                }
                else
                {
                    SMClient.PatchStorageJob(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);
                    WriteDebug(status);
                }
            }
        }