winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

ResourceItem.cs (2505B)


      1 // -----------------------------------------------------------------------------
      2 // <copyright file="ResourceItem.cs" company="Microsoft Corporation">
      3 //     Copyright (c) Microsoft Corporation. Licensed under the MIT License.
      4 // </copyright>
      5 // -----------------------------------------------------------------------------
      6 
      7 namespace Microsoft.Management.Configuration.Processor.DSCv3.Schema_2024_04.Outputs
      8 {
      9     using System.Collections.Generic;
     10     using System.Text.Json.Nodes;
     11     using System.Text.Json.Serialization;
     12     using Microsoft.Management.Configuration.Processor.DSCv3.Model;
     13     using Microsoft.Management.Configuration.Processor.Extensions;
     14     using Windows.Foundation.Collections;
     15 
     16     /// <summary>
     17     /// The object type from a single resource item.
     18     /// </summary>
     19     internal class ResourceItem : IResourceExportItem
     20     {
     21         /// <summary>
     22         /// Gets or sets the type of the resource.
     23         /// Should match the regex "^\\w+(\\.\\w+){0,2}\\/\\w+$".
     24         /// </summary>
     25         [JsonRequired]
     26         required public string Type { get; set; }
     27 
     28         /// <summary>
     29         /// Gets or sets the name of the resource instance.
     30         /// </summary>
     31         [JsonRequired]
     32         required public string Name { get; set; }
     33 
     34         /// <summary>
     35         /// Gets or sets the properties object.
     36         /// </summary>
     37         public JsonObject? Properties { get; set; }
     38 
     39         /// <summary>
     40         /// Gets or sets the metadata object.
     41         /// </summary>
     42         [JsonPropertyName("metadata")]
     43         public JsonObject? MetadataObject { get; set; }
     44 
     45         /// <summary>
     46         /// Gets or sets the dependencies.
     47         /// </summary>
     48         [JsonPropertyName("dependencies")]
     49         public List<string> DependenciesList { get; set; } = new List<string>();
     50 
     51         /// <inheritdoc />
     52         [JsonIgnore]
     53         public ValueSet Settings
     54         {
     55             get
     56             {
     57                 return this.Properties.ToValueSet();
     58             }
     59         }
     60 
     61         /// <inheritdoc />
     62         [JsonIgnore]
     63         public ValueSet Metadata
     64         {
     65             get
     66             {
     67                 return this.MetadataObject.ToValueSet();
     68             }
     69         }
     70 
     71         /// <inheritdoc />
     72         [JsonIgnore]
     73         public IList<string> Dependencies
     74         {
     75             get
     76             {
     77                 return this.DependenciesList;
     78             }
     79         }
     80     }
     81 }