/// <summary> /// Initializes a new instance of the ContainerCodePackageProperties /// class. /// </summary> /// <param name="name">The name of the code package.</param> /// <param name="image">The Container image to use.</param> /// <param name="resources">The resources required by this /// container.</param> /// <param name="imageRegistryCredential">Image registry /// credential.</param> /// <param name="entrypoint">Override for the default entry point in /// the container.</param> /// <param name="commands">Command array to execute within the /// container in exec form.</param> /// <param name="environmentVariables">The environment variables to set /// in this container</param> /// <param name="settings">The settings to set in this container. The /// setting file path can be fetched from environment variable /// "Fabric_SettingPath". The path for Windows container is /// "C:\\secrets". The path for Linux container is /// "/var/secrets".</param> /// <param name="labels">The labels to set in this container.</param> /// <param name="endpoints">The endpoints exposed by this /// container.</param> /// <param name="volumeRefs">Volumes to be attached to the container. /// The lifetime of these volumes is independent of the application's /// lifetime.</param> /// <param name="volumes">Volumes to be attached to the container. The /// lifetime of these volumes is scoped to the application's /// lifetime.</param> /// <param name="diagnostics">Reference to sinks in /// DiagnosticsDescription.</param> /// <param name="reliableCollectionsRefs">A list of ReliableCollection /// resources used by this particular code package. Please refer to /// ReliableCollectionsRef for more details.</param> /// <param name="instanceView">Runtime information of a container /// instance.</param> public ContainerCodePackageProperties(string name, string image, ResourceRequirements resources, ImageRegistryCredential imageRegistryCredential = default(ImageRegistryCredential), string entrypoint = default(string), IList <string> commands = default(IList <string>), IList <EnvironmentVariable> environmentVariables = default(IList <EnvironmentVariable>), IList <Setting> settings = default(IList <Setting>), IList <ContainerLabel> labels = default(IList <ContainerLabel>), IList <EndpointProperties> endpoints = default(IList <EndpointProperties>), IList <VolumeReference> volumeRefs = default(IList <VolumeReference>), IList <ApplicationScopedVolume> volumes = default(IList <ApplicationScopedVolume>), DiagnosticsRef diagnostics = default(DiagnosticsRef), IList <ReliableCollectionsRef> reliableCollectionsRefs = default(IList <ReliableCollectionsRef>), ContainerInstanceView instanceView = default(ContainerInstanceView)) { Name = name; Image = image; ImageRegistryCredential = imageRegistryCredential; Entrypoint = entrypoint; Commands = commands; EnvironmentVariables = environmentVariables; Settings = settings; Labels = labels; Endpoints = endpoints; Resources = resources; VolumeRefs = volumeRefs; Volumes = volumes; Diagnostics = diagnostics; ReliableCollectionsRefs = reliableCollectionsRefs; InstanceView = instanceView; CustomInit(); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (Name == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } if (Image == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Image"); } if (Resources == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Resources"); } if (ImageRegistryCredential != null) { ImageRegistryCredential.Validate(); } if (Labels != null) { foreach (var element in Labels) { if (element != null) { element.Validate(); } } } if (Endpoints != null) { foreach (var element1 in Endpoints) { if (element1 != null) { element1.Validate(); } } } if (Resources != null) { Resources.Validate(); } if (VolumeRefs != null) { foreach (var element2 in VolumeRefs) { if (element2 != null) { element2.Validate(); } } } if (Volumes != null) { foreach (var element3 in Volumes) { if (element3 != null) { element3.Validate(); } } } if (ReliableCollectionsRefs != null) { foreach (var element4 in ReliableCollectionsRefs) { if (element4 != null) { element4.Validate(); } } } }