github.com/opentofu/opentofu@v1.7.1/internal/registry/response/module_versions.go (about)

     1  // Copyright (c) The OpenTofu Authors
     2  // SPDX-License-Identifier: MPL-2.0
     3  // Copyright (c) 2023 HashiCorp, Inc.
     4  // SPDX-License-Identifier: MPL-2.0
     5  
     6  package response
     7  
     8  // ModuleVersions is the response format that contains all metadata about module
     9  // versions needed for tofu CLI to resolve version constraints. See RFC
    10  // TF-042 for details on this format.
    11  type ModuleVersions struct {
    12  	Modules []*ModuleProviderVersions `json:"modules"`
    13  }
    14  
    15  // ModuleProviderVersions is the response format for a single module instance,
    16  // containing metadata about all versions and their dependencies.
    17  type ModuleProviderVersions struct {
    18  	Source   string           `json:"source"`
    19  	Versions []*ModuleVersion `json:"versions"`
    20  }
    21  
    22  // ModuleVersion is the output metadata for a given version needed by CLI to
    23  // resolve candidate versions to satisfy requirements.
    24  type ModuleVersion struct {
    25  	Version    string              `json:"version"`
    26  	Root       VersionSubmodule    `json:"root"`
    27  	Submodules []*VersionSubmodule `json:"submodules"`
    28  }
    29  
    30  // VersionSubmodule is the output metadata for a submodule within a given
    31  // version needed by CLI to resolve candidate versions to satisfy requirements.
    32  // When representing the Root in JSON the path is omitted.
    33  type VersionSubmodule struct {
    34  	Path         string               `json:"path,omitempty"`
    35  	Providers    []*ModuleProviderDep `json:"providers"`
    36  	Dependencies []*ModuleDep         `json:"dependencies"`
    37  }