dsc kaynak şeması

Özet

Bir kaynağın örnekleri için JSON Şemasını döndürür.

Syntax

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

Description

Alt komut, schema belirli bir DSC Kaynağının örnekleri için JSON şemasını döndürür. DSC, , setve alt komutlarının girişini doğrulamak ve gettest bir DSC Yapılandırma belgesindeki örnekleri doğrularken bu şemaları kullanır.

Tümleştirme araçları doğrulama veya yapılandırma yazma deneyimini geliştirmek için bu şemaları kullanabilir. Kaynağın örnek şeması, hangi özelliklerin zorunlu olduğu ve değerlerinin ne olması gerektiği dahil olmak üzere bir örnek için geçerli yapıyı tanımlar. Örnek şemaları, ve description anahtar sözcükleriyle birlikte title özelliklere yönelik basit belgeler de içerebilir.

Örnekler

Örnek 1 - Bir kaynağın şemasını alma

Bu örnek, komut tabanlı DSC Kaynağının şemasını OSInfo döndürür.

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

Seçenekler

-r, --resource

örnek şemasının alınacağını DSC Kaynağının tam tür adını belirtir, örneğin Microsoft.Windows/Registry.

Tam tür adı söz dizimi: <owner>[.<group>][.<area>]/<name>, burada:

  • owner, kaynağın bakım yazarı veya kuruluşudur.
  • group vearea, bir kaynak için namepacing özelliğini etkinleştiren isteğe bağlı ad bileşenleridir.
  • kaynağın name yönettiği bileşeni tanımlar.
Type:      String
Mandatory: true

-f, --format

seçeneği, --format komutun konsol çıkış biçimini denetler. Komut çıkışı bir değişken olarak yeniden yönlendirilir veya yakalanırsa, çıkış her zaman JSON olur.

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

-h, --help

Geçerli komut veya alt komut için yardım görüntüler. Bu seçeneği belirttiğinizde, uygulama bundan sonraki tüm seçenekleri ve bağımsız değişkenleri yoksayar.

Type:      Boolean
Mandatory: false

Çıktı

Bu komut, belirtilen DSC Kaynağının bir örneği için JSON şemasını temsil eden bir JSON nesnesi döndürür.