مخطط مورد dsc

الخلاصة

إرجاع مخطط JSON لمثيلات مورد.

بناء الجملة

dsc resource schema [Options] --resource <RESOURCE>

الوصف

يقوم schema الأمر الفرعي بإرجاع مخطط JSON لمثيلات مورد DSC معين. يستخدم DSC هذه المخططات للتحقق من صحة إدخال getsetالأوامر الفرعية و و test وعند التحقق من صحة المثيلات في مستند تكوين DSC.

قد تستخدم أدوات التكامل هذه المخططات للتحقق من الصحة أو لتحسين تجربة تأليف التكوين. يحدد مخطط مثيل المورد البنية الصالحة لمثيل، بما في ذلك الخصائص الإلزامية وقيمها التي يجب أن تكون. قد تتضمن مخططات المثيل أيضا وثائق خفيفة الوزن للخصائص مع title الكلمات الأساسية و description .

أمثلة

مثال 1 - الحصول على مخطط لمورد

يرجع هذا المثال مخطط OSInfo مورد DSC المستند إلى الأمر.

dsc resource schema --resource Microsoft/OSInfo
$schema: http://json-schema.org/draft-07/schema#
$id: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/resources/Microsoft/OSInfo/v0.1.0/schema.json
title: OsInfo
description: |
  Returns information about the operating system.

  https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource
markdownDescription: |
  The `Microsoft/OSInfo` resource enables you to assert whether a machine meets criteria related to
  the operating system. The resource is only capable of assertions. It doesn't implement the set
  operation and can't configure the operating system.

  [Online documentation][01]

  [01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource
type: object
required: []
additionalProperties: false
properties:
  $id:
    type: string
    readOnly: true
    title: Data Type ID
    description: |
      Returns the unique ID for the OSInfo instance data type.

      https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#id
    markdownDescription: |
      Returns the unique ID for the OSInfo instance data type.

      [Online documentation][01]

      [01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#id
  architecture:
    type: string
    title: Processor architecture
    description: |
      Defines the processor architecture as reported by 'uname -m' on the operating system.

      https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#architecture
    markdownDescription: |
      Defines the processor architecture as reported by `uname -m` on the operating system.

      [Online documentation][01]

      [01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#architecture
  bitness:
    type: string
    enum:
    - '32'
    - '64'
    - unknown
    title: Operating system bitness
    description: |
      Defines whether the operating system is a 32-bit or 64-bit operating system.

      https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#bitness
    markdownDescription: |
      Defines whether the operating system is a 32-bit or 64-bit operating system.

      [Online documentation][01]

      [01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#bitness
  codename:
    type: string
    title: Linux codename
    description: |
      Defines the codename for the operating system as returned from 'lsb_release --codename'.

      https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#codename
    markdownDescription: |
      Defines the codename for the operating system as returned from `lsb_release --codename`.

      [Online documentation][01]

      [01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#codename
  edition:
    type: string
    title: Windows edition
    description: |
      Defines the operating system edition, like 'Windows 11' or 'Windows Server 2016'.

      https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#edition
    markdownDescription: |
      Defines the operating system edition, like `Windows 11` or `Windows Server 2016`.

      [Online documentation][01]

      [01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#edition
  family:
    type: string
    enum:
    - Linux
    - macOS
    - Windows
    title: Operating system family
    description: |
      Defines whether the operating system is Linux, macOS, or Windows.

      https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#family
    markdownDescription: |
      Defines whether the operating system is Linux, macOS, or Windows.

      [Online documentation][01]

      [01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#family
  version:
    type: string
    title: Operating system version
    description: |
      Defines the version of the operating system as a string.

      https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#version
    markdownDescription: |
      Defines the version of the operating system as a string.

      [Online documentation][01]

      [01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#version

الخيارات

-r، --resource

يحدد اسم النوع المؤهل بالكامل لمورد DSC لاسترداد مخطط المثيل منه، مثل Microsoft.Windows/Registry.

بناء جملة اسم النوع المؤهل بالكامل هو: <owner>[.<group>][.<area>]/<name>، حيث:

  • owner هو الكاتب أو المؤسسة المحتفظ بها للمورد.
  • و grouparea هما مكونان اختياريان للاسم يتيحان مسار الأسماء لمورد.
  • name يحدد المكون الذي يديره المورد.
Type:      String
Mandatory: true

-f، --format

--format يتحكم الخيار في تنسيق إخراج وحدة التحكم للأمر . إذا تمت إعادة توجيه إخراج الأمر أو التقاطه كمتغير، يكون الإخراج دائما JSON.

Type:         String
Mandatory:    false
DefaultValue: yaml
ValidValues:  [json, pretty-json, yaml]

-h، - مساعدة

يعرض التعليمات للأمر الحالي أو الأمر الفرعي الحالي. عند تحديد هذا الخيار، يتجاهل التطبيق جميع الخيارات والوسيطات بعد هذا الخيار.

Type:      Boolean
Mandatory: false

المخرجات

يقوم هذا الأمر بإرجاع كائن JSON يمثل مخطط JSON لمثيل مورد DSC المحدد.