다음을 통해 공유


dsc 리소스 스키마

개요

리소스 인스턴스에 대한 JSON 스키마를 반환합니다.

구문

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

Description

schema 하위 명령은 특정 DSC 리소스 인스턴스에 대한 JSON 스키마를 반환합니다. DSC는 이러한 스키마를 사용하여 , set및 하위 명령에 대한 get입력의 유효성을 검사하고 test DSC 구성 문서에서 인스턴스의 유효성을 검사합니다.

도구를 통합하면 이러한 스키마를 사용하여 유효성을 검사하거나 구성 제작 환경을 향상시킬 수 있습니다. 리소스의 instance 스키마는 필수 속성과 해당 값이 무엇인지를 포함하여 instance 유효한 구조를 정의합니다. instance 스키마에는 및 description 키워드가 있는 title 속성에 대한 간단한 설명서도 포함될 수 있습니다.

예제

예제 1 - 리소스에 대한 스키마 가져오기

이 예제에서는 명령 기반 DSC 리소스에 OSInfo 대한 스키마를 반환합니다.

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

와 같이 Microsoft.Windows/Registryinstance 스키마를 검색할 DSC 리소스의 정규화된 형식 이름을 지정합니다.

정규화된 형식 이름 구문은 입니다 <owner>[.<group>][.<area>]/<name>. 여기서:

  • owner 리소스에 대한 유지 관리 작성자 또는 organization.
  • areagroup 리소스에 대한 이름 간격을 사용하도록 설정하는 선택적 이름 구성 요소입니다.
  • name 리소스가 관리하는 구성 요소를 식별합니다.
Type:      String
Mandatory: true

-f, --format

옵션은 --format 명령에 대한 콘솔 출력 형식을 제어합니다. 명령 출력이 변수로 리디렉션되거나 캡처되는 경우 출력은 항상 JSON입니다.

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

-h, --help

현재 명령 또는 하위 명령에 대한 도움말을 표시합니다. 이 옵션을 지정하면 애플리케이션은 이 옵션 다음에 있는 모든 옵션과 인수를 무시합니다.

Type:      Boolean
Mandatory: false

출력

이 명령은 지정된 DSC 리소스의 instance 대한 JSON 스키마를 나타내는 JSON 개체를 반환합니다.