//-----------------------------------------------------------------------
// Copyright (C) 2013 Microsoft Corporation
//
//-----------------------------------------------------------------------
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace System.Management.Automation
{
///
/// Enumerated values for DSC resource implementation type
///
public enum ImplementedAsType
{
///
/// DSC resource implementation type not known
///
None = 0,
///
/// DSC resource is implemented using PowerShell module
///
PowerShell = 1,
///
/// DSC resource is implemented using a CIM provider
///
Binary = 2,
///
/// DSC resource is a composite and implemented using configuration keyword
///
Composite = 3
}
///
/// Contains a DSC resource information
///
public class DscResourceInfo
{
///
/// Initializes a new instance of the DscResourceInfo class
///
/// Name of the DscResource.
/// FriendlyName of the DscResource.
/// Path of the DscResource.
/// ParentPath of the DscResource.
/// The execution context for the DscResource.
internal DscResourceInfo(string name, string friendlyName, string path, string parentPath, ExecutionContext context)
{
this.Name = name;
this.FriendlyName = friendlyName;
this.Path = path;
this.ParentPath = parentPath;
this.Properties = new ReadOnlyCollection(new List());
}
///
/// Name of the DSC Resource.
///
public string Name { get; private set; }
///
/// Gets or sets resource type name
///
public string ResourceType { get; set; }
///
/// Gets or sets friendly name defined for the resource
///
public string FriendlyName { get; set; }
///
/// Gets or sets of the file which implements the resource. For the resources which are defined using
/// MOF file, this will be path to a module which resides in the same folder where schema.mof file is present.
/// For composite resources, this will be the module which implements the resource
///
public string Path { get; set; }
///
/// Gets or sets parent folder, where the resource is defined
/// It is the folder containing either the implementing module(=Path) or folder containing ".schema.mof".
/// For native providers, Path will be null and only ParentPath will be present.
///
public string ParentPath { get; set; }
///
/// Gets or sets a value which indicate how DSC resource is implemented
///
public ImplementedAsType ImplementedAs { get; set; }
///
/// Gets or sets company which owns this resource
///
public string CompanyName { get; set; }
///
/// Gets or sets properties of the resource
///
public ReadOnlyCollection Properties { get; private set; }
///
/// Updates properties of the resource
///
/// Updated properties
public void UpdateProperties(IList properties)
{
if (properties != null)
this.Properties = new ReadOnlyCollection(properties);
}
///
/// Module in which the DscResource is implemented in.
///
public PSModuleInfo Module { get; internal set; }
///
/// Gets the help file path for the cmdlet.
///
public string HelpFile { get; internal set; } = String.Empty;
// HelpFile
}
///
/// Contains a DSC resource property information
///
public sealed class DscResourcePropertyInfo
{
///
/// Initializes a new instance of the DscResourcePropertyInfo class
///
internal DscResourcePropertyInfo()
{
this.Values = new ReadOnlyCollection(new List());
}
///
/// Gets or sets name of the property
///
public string Name { get; set; }
///
/// Gets or sets type of the property
///
public string PropertyType { get; set; }
///
/// Gets or sets a value indicating whether the property is mandatory or not
///
public bool IsMandatory { get; set; }
///
/// Gets Values for a resource property
///
public ReadOnlyCollection Values { get; private set; }
internal void UpdateValues(IList values)
{
if (values != null)
this.Values = new ReadOnlyCollection(values);
}
}
}