/// <summary> /// Initializes a new instance of the IoTRole class. /// </summary> /// <param name="hostPlatform">Host OS supported by the IoT role. /// Possible values include: 'Windows', 'Linux'</param> /// <param name="ioTDeviceDetails">IoT device metadata to which data /// box edge device needs to be connected.</param> /// <param name="ioTEdgeDeviceDetails">IoT edge device to which the IoT /// role needs to be configured.</param> /// <param name="roleStatus">Role status. Possible values include: /// 'Enabled', 'Disabled'</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="systemData">Role configured on ASE resource</param> /// <param name="shareMappings">Mount points of shares in /// role(s).</param> /// <param name="ioTEdgeAgentInfo">Iot edge agent details to download /// the agent and bootstrap iot runtime.</param> /// <param name="hostPlatformType">Platform where the Iot runtime is /// hosted. Possible values include: 'KubernetesCluster', /// 'LinuxVM'</param> /// <param name="computeResource">Resource allocation</param> public IoTRole(string hostPlatform, IoTDeviceInfo ioTDeviceDetails, IoTDeviceInfo ioTEdgeDeviceDetails, string roleStatus, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IList <MountPointMap> shareMappings = default(IList <MountPointMap>), IoTEdgeAgentInfo ioTEdgeAgentInfo = default(IoTEdgeAgentInfo), string hostPlatformType = default(string), ComputeResource computeResource = default(ComputeResource)) : base(id, name, type, systemData) { HostPlatform = hostPlatform; IoTDeviceDetails = ioTDeviceDetails; IoTEdgeDeviceDetails = ioTEdgeDeviceDetails; ShareMappings = shareMappings; IoTEdgeAgentInfo = ioTEdgeAgentInfo; HostPlatformType = hostPlatformType; ComputeResource = computeResource; RoleStatus = roleStatus; CustomInit(); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (HostPlatform == null) { throw new ValidationException(ValidationRules.CannotBeNull, "HostPlatform"); } if (IoTDeviceDetails == null) { throw new ValidationException(ValidationRules.CannotBeNull, "IoTDeviceDetails"); } if (IoTEdgeDeviceDetails == null) { throw new ValidationException(ValidationRules.CannotBeNull, "IoTEdgeDeviceDetails"); } if (RoleStatus == null) { throw new ValidationException(ValidationRules.CannotBeNull, "RoleStatus"); } if (IoTDeviceDetails != null) { IoTDeviceDetails.Validate(); } if (IoTEdgeDeviceDetails != null) { IoTEdgeDeviceDetails.Validate(); } if (ShareMappings != null) { foreach (var element in ShareMappings) { if (element != null) { element.Validate(); } } } if (IoTEdgeAgentInfo != null) { IoTEdgeAgentInfo.Validate(); } if (ComputeResource != null) { ComputeResource.Validate(); } }