/// <summary>
        /// Initializes a new instance of the <see cref="RunbookVersion"/> class.
        /// </summary>
        /// <param name="runbookVersion">
        /// The runbook version.
        /// </param>
        public RunbookVersion(AutomationManagement.Models.RunbookVersion runbookVersion)
        {
            Requires.Argument("runbookVersion", runbookVersion).NotNull();

            this.AccountId        = new Guid(runbookVersion.AccountId);
            this.Id               = new Guid(runbookVersion.Id);
            this.RunbookId        = new Guid(runbookVersion.RunbookId);
            this.VersionNumber    = runbookVersion.VersionNumber;
            this.IsDraft          = runbookVersion.IsDraft;
            this.CreationTime     = DateTime.SpecifyKind(runbookVersion.CreationTime, DateTimeKind.Utc).ToLocalTime();
            this.LastModifiedTime = DateTime.SpecifyKind(runbookVersion.LastModifiedTime, DateTimeKind.Utc).ToLocalTime();
        }
Esempio n. 2
0
 public IEnumerable <RunbookDefinition> ListRunbookDefinitionsByRunbookVersionId(string automationAccountName, Guid runbookVersionId, bool?isDraft)
 {
     AutomationManagement.Models.RunbookVersion runbookVersionModel = this.GetRunbookVersionModel(automationAccountName, runbookVersionId);
     if (!isDraft.HasValue || isDraft.Value == runbookVersionModel.IsDraft)
     {
         return(this.CreateRunbookDefinitionsFromRunbookVersionModels(
                    automationAccountName, new List <AutomationManagement.Models.RunbookVersion> {
             runbookVersionModel
         }));
     }
     else
     {
         return(new List <RunbookDefinition>());
     }
 }
Esempio n. 3
0
        private AutomationManagement.Models.RunbookVersion GetRunbookVersionModel(
            string automationAccountName, Guid runbookVersionId)
        {
            AutomationManagement.Models.RunbookVersion runbookVersionModel =
                this.automationManagementClient.RunbookVersions.Get(
                    automationAccountName,
                    runbookVersionId.ToString()).RunbookVersion;

            if (runbookVersionModel == null)
            {
                throw new ResourceNotFoundException(
                          typeof(RunbookVersion),
                          string.Format(CultureInfo.CurrentCulture, Resources.RunbookVersionNotFoundById, runbookVersionId));
            }

            return(runbookVersionModel);
        }