Пример #1
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (ContentLink != null)
     {
         ContentLink.Validate();
     }
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the ModuleUpdateParameters class.
 /// </summary>
 /// <param name="contentLink">Gets or sets the module content
 /// link.</param>
 /// <param name="name">Gets or sets name of the resource.</param>
 /// <param name="location">Gets or sets the location of the
 /// resource.</param>
 /// <param name="tags">Gets or sets the tags attached to the
 /// resource.</param>
 public ModuleUpdateParameters(ContentLink contentLink = default(ContentLink), string name = default(string), string location = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>))
 {
     ContentLink = contentLink;
     Name        = name;
     Location    = location;
     Tags        = tags;
     CustomInit();
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the ModuleCreateOrUpdateProperties
 /// class with required arguments.
 /// </summary>
 public ModuleCreateOrUpdateProperties(ContentLink contentLink)
     : this()
 {
     if (contentLink == null)
     {
         throw new ArgumentNullException("contentLink");
     }
     this.ContentLink = contentLink;
 }
 /// <summary>
 /// Initializes a new instance of the ModuleCreateOrUpdateProperties
 /// class with required arguments.
 /// </summary>
 public ModuleCreateOrUpdateProperties(ContentLink contentLink)
     : this()
 {
     if (contentLink == null)
     {
         throw new ArgumentNullException("contentLink");
     }
     this.ContentLink = contentLink;
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the RunbookDraft class.
 /// </summary>
 /// <param name="inEdit">Gets or sets whether runbook is in edit
 /// mode.</param>
 /// <param name="draftContentLink">Gets or sets the draft runbook
 /// content link.</param>
 /// <param name="creationTime">Gets or sets the creation time of the
 /// runbook draft.</param>
 /// <param name="lastModifiedTime">Gets or sets the last modified time
 /// of the runbook draft.</param>
 /// <param name="parameters">Gets or sets the runbook draft
 /// parameters.</param>
 /// <param name="outputTypes">Gets or sets the runbook output
 /// types.</param>
 public RunbookDraft(bool?inEdit = default(bool?), ContentLink draftContentLink = default(ContentLink), System.DateTimeOffset creationTime = default(System.DateTimeOffset), System.DateTimeOffset lastModifiedTime = default(System.DateTimeOffset), IDictionary <string, RunbookParameter> parameters = default(IDictionary <string, RunbookParameter>), IList <string> outputTypes = default(IList <string>))
 {
     InEdit           = inEdit;
     DraftContentLink = draftContentLink;
     CreationTime     = creationTime;
     LastModifiedTime = lastModifiedTime;
     Parameters       = parameters;
     OutputTypes      = outputTypes;
     CustomInit();
 }
Пример #6
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (ContentLink == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "ContentLink");
     }
     if (ContentLink != null)
     {
         ContentLink.Validate();
     }
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the RunbookCreateOrUpdateParameters
 /// class.
 /// </summary>
 /// <param name="runbookType">Gets or sets the type of the runbook.
 /// Possible values include: 'Script', 'Graph', 'PowerShellWorkflow',
 /// 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell'</param>
 /// <param name="logVerbose">Gets or sets verbose log option.</param>
 /// <param name="logProgress">Gets or sets progress log option.</param>
 /// <param name="draft">Gets or sets the draft runbook
 /// properties.</param>
 /// <param name="publishContentLink">Gets or sets the published runbook
 /// content link.</param>
 /// <param name="description">Gets or sets the description of the
 /// runbook.</param>
 /// <param name="logActivityTrace">Gets or sets the activity-level
 /// tracing options of the runbook.</param>
 /// <param name="name">Gets or sets the name of the resource.</param>
 /// <param name="location">Gets or sets the location of the
 /// resource.</param>
 /// <param name="tags">Gets or sets the tags attached to the
 /// resource.</param>
 public RunbookCreateOrUpdateParameters(string runbookType, bool?logVerbose = default(bool?), bool?logProgress = default(bool?), RunbookDraft draft = default(RunbookDraft), ContentLink publishContentLink = default(ContentLink), string description = default(string), int?logActivityTrace = default(int?), string name = default(string), string location = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>))
 {
     LogVerbose         = logVerbose;
     LogProgress        = logProgress;
     RunbookType        = runbookType;
     Draft              = draft;
     PublishContentLink = publishContentLink;
     Description        = description;
     LogActivityTrace   = logActivityTrace;
     Name     = name;
     Location = location;
     Tags     = tags;
     CustomInit();
 }
 /// <summary>
 /// Initializes a new instance of the RunbookCreateOrUpdateProperties
 /// class with required arguments.
 /// </summary>
 public RunbookCreateOrUpdateProperties(string runbookType, ContentLink publishContentLink)
     : this()
 {
     if (runbookType == null)
     {
         throw new ArgumentNullException("runbookType");
     }
     if (publishContentLink == null)
     {
         throw new ArgumentNullException("publishContentLink");
     }
     this.RunbookType        = runbookType;
     this.PublishContentLink = publishContentLink;
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the Module class.
 /// </summary>
 /// <param name="id">Fully qualified resource Id for the
 /// resource</param>
 /// <param name="name">The name of the resource</param>
 /// <param name="type">The type of the resource.</param>
 /// <param name="tags">Resource tags.</param>
 /// <param name="location">The Azure Region where the resource
 /// lives</param>
 /// <param name="isGlobal">Gets or sets the isGlobal flag of the
 /// module.</param>
 /// <param name="version">Gets or sets the version of the
 /// module.</param>
 /// <param name="sizeInBytes">Gets or sets the size in bytes of the
 /// module.</param>
 /// <param name="activityCount">Gets or sets the activity count of the
 /// module.</param>
 /// <param name="provisioningState">Gets or sets the provisioning state
 /// of the module. Possible values include: 'Created', 'Creating',
 /// 'StartingImportModuleRunbook', 'RunningImportModuleRunbook',
 /// 'ContentRetrieved', 'ContentDownloaded', 'ContentValidated',
 /// 'ConnectionTypeImported', 'ContentStored', 'ModuleDataStored',
 /// 'ActivitiesStored', 'ModuleImportRunbookComplete', 'Succeeded',
 /// 'Failed', 'Cancelled', 'Updating'</param>
 /// <param name="contentLink">Gets or sets the contentLink of the
 /// module.</param>
 /// <param name="error">Gets or sets the error info of the
 /// module.</param>
 /// <param name="creationTime">Gets or sets the creation time.</param>
 /// <param name="lastModifiedTime">Gets or sets the last modified
 /// time.</param>
 /// <param name="description">Gets or sets the description.</param>
 /// <param name="isComposite">Gets or sets type of module, if its
 /// composite or not.</param>
 /// <param name="etag">Gets or sets the etag of the resource.</param>
 public Module(string id = default(string), string name = default(string), string type = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), string location = default(string), bool?isGlobal = default(bool?), string version = default(string), long?sizeInBytes = default(long?), int?activityCount = default(int?), ModuleProvisioningState?provisioningState = default(ModuleProvisioningState?), ContentLink contentLink = default(ContentLink), ModuleErrorInfo error = default(ModuleErrorInfo), System.DateTimeOffset creationTime = default(System.DateTimeOffset), System.DateTimeOffset lastModifiedTime = default(System.DateTimeOffset), string description = default(string), bool?isComposite = default(bool?), string etag = default(string))
     : base(id, name, type, tags, location)
 {
     IsGlobal          = isGlobal;
     Version           = version;
     SizeInBytes       = sizeInBytes;
     ActivityCount     = activityCount;
     ProvisioningState = provisioningState;
     ContentLink       = contentLink;
     Error             = error;
     CreationTime      = creationTime;
     LastModifiedTime  = lastModifiedTime;
     Description       = description;
     IsComposite       = isComposite;
     Etag = etag;
     CustomInit();
 }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the Runbook class.
 /// </summary>
 /// <param name="id">Fully qualified resource Id for the
 /// resource</param>
 /// <param name="name">The name of the resource</param>
 /// <param name="type">The type of the resource.</param>
 /// <param name="tags">Resource tags.</param>
 /// <param name="location">The Azure Region where the resource
 /// lives</param>
 /// <param name="runbookType">Gets or sets the type of the runbook.
 /// Possible values include: 'Script', 'Graph', 'PowerShellWorkflow',
 /// 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell'</param>
 /// <param name="publishContentLink">Gets or sets the published runbook
 /// content link.</param>
 /// <param name="state">Gets or sets the state of the runbook. Possible
 /// values include: 'New', 'Edit', 'Published'</param>
 /// <param name="logVerbose">Gets or sets verbose log option.</param>
 /// <param name="logProgress">Gets or sets progress log option.</param>
 /// <param name="logActivityTrace">Gets or sets the option to log
 /// activity trace of the runbook.</param>
 /// <param name="jobCount">Gets or sets the job count of the
 /// runbook.</param>
 /// <param name="parameters">Gets or sets the runbook
 /// parameters.</param>
 /// <param name="outputTypes">Gets or sets the runbook output
 /// types.</param>
 /// <param name="draft">Gets or sets the draft runbook
 /// properties.</param>
 /// <param name="provisioningState">Gets or sets the provisioning state
 /// of the runbook. Possible values include: 'Succeeded'</param>
 /// <param name="lastModifiedBy">Gets or sets the last modified
 /// by.</param>
 /// <param name="creationTime">Gets or sets the creation time.</param>
 /// <param name="lastModifiedTime">Gets or sets the last modified
 /// time.</param>
 /// <param name="description">Gets or sets the description.</param>
 /// <param name="etag">Gets or sets the etag of the resource.</param>
 public Runbook(string id = default(string), string name = default(string), string type = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), string location = default(string), string runbookType = default(string), ContentLink publishContentLink = default(ContentLink), string state = default(string), bool?logVerbose = default(bool?), bool?logProgress = default(bool?), int?logActivityTrace = default(int?), int?jobCount = default(int?), IDictionary <string, RunbookParameter> parameters = default(IDictionary <string, RunbookParameter>), IList <string> outputTypes = default(IList <string>), RunbookDraft draft = default(RunbookDraft), RunbookProvisioningState?provisioningState = default(RunbookProvisioningState?), string lastModifiedBy = default(string), System.DateTimeOffset creationTime = default(System.DateTimeOffset), System.DateTimeOffset lastModifiedTime = default(System.DateTimeOffset), string description = default(string), string etag = default(string))
     : base(id, name, type, tags, location)
 {
     RunbookType        = runbookType;
     PublishContentLink = publishContentLink;
     State             = state;
     LogVerbose        = logVerbose;
     LogProgress       = logProgress;
     LogActivityTrace  = logActivityTrace;
     JobCount          = jobCount;
     Parameters        = parameters;
     OutputTypes       = outputTypes;
     Draft             = draft;
     ProvisioningState = provisioningState;
     LastModifiedBy    = lastModifiedBy;
     CreationTime      = creationTime;
     LastModifiedTime  = lastModifiedTime;
     Description       = description;
     Etag = etag;
     CustomInit();
 }
 /// <summary>
 /// Initializes a new instance of the PythonPackageCreateParameters
 /// class.
 /// </summary>
 /// <param name="contentLink">Gets or sets the module content
 /// link.</param>
 /// <param name="tags">Gets or sets the tags attached to the
 /// resource.</param>
 public PythonPackageCreateParameters(ContentLink contentLink, IDictionary <string, string> tags = default(IDictionary <string, string>))
 {
     ContentLink = contentLink;
     Tags        = tags;
     CustomInit();
 }
Пример #12
0
        public async Task<bool> SaveModuleAsync(ModuleModelProxy module)
        {
            var contentLink = new ContentLink();
            contentLink.Uri = new Uri(module.ModuleUrl);
            contentLink.Version = module.ModuleVersion;

            var moduleToSave = new ModuleCreateOrUpdateParameters();
            moduleToSave.Name = module.ModuleName;
            moduleToSave.Location = _connectionData.AzureRMLocation;

            moduleToSave.Properties = new ModuleCreateOrUpdateProperties();
            moduleToSave.Properties.ContentLink = contentLink;

            var response = await _client.Modules.CreateOrUpdateAsync(_connectionData.AzureRMGroupName, _connectionData.AzureAutomationAccount, moduleToSave);

            if (response.StatusCode == System.Net.HttpStatusCode.InternalServerError)
            {
                _output.AppendLine("Unable to save the module at the moment, please verify your connectivity and try again.");
                return false;
            }

            return true;
        }
 /// <summary>
 /// Initializes a new instance of the RunbookCreateOrUpdateProperties
 /// class with required arguments.
 /// </summary>
 public RunbookCreateOrUpdateProperties(string runbookType, ContentLink publishContentLink)
     : this()
 {
     if (runbookType == null)
     {
         throw new ArgumentNullException("runbookType");
     }
     if (publishContentLink == null)
     {
         throw new ArgumentNullException("publishContentLink");
     }
     this.RunbookType = runbookType;
     this.PublishContentLink = publishContentLink;
 }