/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (ShareStatus == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ShareStatus"); } if (MonitoringStatus == null) { throw new ValidationException(ValidationRules.CannotBeNull, "MonitoringStatus"); } if (AccessProtocol == null) { throw new ValidationException(ValidationRules.CannotBeNull, "AccessProtocol"); } if (AzureContainerInfo != null) { AzureContainerInfo.Validate(); } if (UserAccessRights != null) { foreach (var element in UserAccessRights) { if (element != null) { element.Validate(); } } } if (ClientAccessRights != null) { foreach (var element1 in ClientAccessRights) { if (element1 != null) { element1.Validate(); } } } if (ShareMappings != null) { foreach (var element2 in ShareMappings) { if (element2 != null) { element2.Validate(); } } } }
/// <summary> /// Initializes a new instance of the Share class. /// </summary> /// <param name="shareStatus">Current status of the share. Possible /// values include: 'Offline', 'Unknown', 'OK', 'Updating', /// 'NeedsAttention'</param> /// <param name="monitoringStatus">Current monitoring status of the /// share. Possible values include: 'Enabled', 'Disabled'</param> /// <param name="accessProtocol">Access protocol to be used by the /// share. Possible values include: 'SMB', 'NFS'</param> /// <param name="id">The path ID that uniquely identifies the /// object.</param> /// <param name="name">The object name.</param> /// <param name="type">The hierarchical type of the object.</param> /// <param name="description">Description for the share.</param> /// <param name="azureContainerInfo">Azure container mapping for the /// share.</param> /// <param name="userAccessRights">Mapping of users and corresponding /// access rights on the share (required for SMB protocol).</param> /// <param name="clientAccessRights">List of IP addresses and /// corresponding access rights on the share(required for NFS /// protocol).</param> /// <param name="refreshDetails">Details of the refresh job on this /// share.</param> /// <param name="shareMappings">Share mount point to the role.</param> /// <param name="dataPolicy">Data policy of the share. Possible values /// include: 'Cloud', 'Local'</param> public Share(string shareStatus, string monitoringStatus, string accessProtocol, string id = default(string), string name = default(string), string type = default(string), string description = default(string), AzureContainerInfo azureContainerInfo = default(AzureContainerInfo), IList <UserAccessRight> userAccessRights = default(IList <UserAccessRight>), IList <ClientAccessRight> clientAccessRights = default(IList <ClientAccessRight>), RefreshDetails refreshDetails = default(RefreshDetails), IList <MountPointMap> shareMappings = default(IList <MountPointMap>), string dataPolicy = default(string)) : base(id, name, type) { Description = description; ShareStatus = shareStatus; MonitoringStatus = monitoringStatus; AzureContainerInfo = azureContainerInfo; AccessProtocol = accessProtocol; UserAccessRights = userAccessRights; ClientAccessRights = clientAccessRights; RefreshDetails = refreshDetails; ShareMappings = shareMappings; DataPolicy = dataPolicy; CustomInit(); }