public override void ExecuteCmdlet()
        {
            string status = string.Empty;

            if (PassThru.IsPresent)
            {
                WriteObject(SMClient.PatchHttpJob(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);
            }
            else
            {
                SMClient.PatchHttpJob(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);
                WriteDebug(status);
            }
        }
        public override void ExecuteCmdlet()
        {
            string status = string.Empty;

            if (!SMClient.GetAvailableRegions().Contains(Location, StringComparer.OrdinalIgnoreCase))
            {
                WriteWarning(Resources.SchedulerInvalidLocation);
            }
            else
            {
                if (PassThru.IsPresent)
                {
                    WriteObject(SMClient.PatchHttpJob(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);
                }
                else
                {
                    SMClient.PatchHttpJob(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);
                    WriteDebug(status);
                }
            }
        }
Ejemplo n.º 3
0
        public override void ExecuteCmdlet()
        {
            string status = string.Empty;

            if (PassThru.IsPresent)
            {
                WriteObject(SMClient.PatchHttpJob(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,
                    HttpAuthType              = HttpAuthenticationType ?? string.Empty,
                    ClientCertPfx             = ClientCertificatePfx == null ? null : SchedulerUtils.GetCertData(this.ResolvePath(ClientCertificatePfx.ToString()), ClientCertificatePassword),
                    ClientCertPassword        = ClientCertificatePassword
                }, out status), true);
                WriteObject(status);
            }
            else
            {
                SMClient.PatchHttpJob(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,
                    HttpAuthType              = HttpAuthenticationType ?? string.Empty,
                    ClientCertPfx             = ClientCertificatePfx == null ? null : SchedulerUtils.GetCertData(this.ResolvePath(ClientCertificatePfx.ToString()), ClientCertificatePassword),
                    ClientCertPassword        = ClientCertificatePassword
                }, out status);
                WriteDebug(status);
            }
        }