github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/registry/response/module.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package response
     5  
     6  import (
     7  	"time"
     8  )
     9  
    10  // Module is the response structure with the data for a single module version.
    11  type Module struct {
    12  	ID string `json:"id"`
    13  
    14  	//---------------------------------------------------------------
    15  	// Metadata about the overall module.
    16  
    17  	Owner       string    `json:"owner"`
    18  	Namespace   string    `json:"namespace"`
    19  	Name        string    `json:"name"`
    20  	Version     string    `json:"version"`
    21  	Provider    string    `json:"provider"`
    22  	Description string    `json:"description"`
    23  	Source      string    `json:"source"`
    24  	PublishedAt time.Time `json:"published_at"`
    25  	Downloads   int       `json:"downloads"`
    26  	Verified    bool      `json:"verified"`
    27  }
    28  
    29  // ModuleDetail represents a module in full detail.
    30  type ModuleDetail struct {
    31  	Module
    32  
    33  	//---------------------------------------------------------------
    34  	// Metadata about the overall module. This is only available when
    35  	// requesting the specific module (not in list responses).
    36  
    37  	// Root is the root module.
    38  	Root *ModuleSubmodule `json:"root"`
    39  
    40  	// Submodules are the other submodules that are available within
    41  	// this module.
    42  	Submodules []*ModuleSubmodule `json:"submodules"`
    43  
    44  	//---------------------------------------------------------------
    45  	// The fields below are only set when requesting this specific
    46  	// module. They are available to easily know all available versions
    47  	// and providers without multiple API calls.
    48  
    49  	Providers []string `json:"providers"` // All available providers
    50  	Versions  []string `json:"versions"`  // All versions
    51  }
    52  
    53  // ModuleSubmodule is the metadata about a specific submodule within
    54  // a module. This includes the root module as a special case.
    55  type ModuleSubmodule struct {
    56  	Path   string `json:"path"`
    57  	Readme string `json:"readme"`
    58  	Empty  bool   `json:"empty"`
    59  
    60  	Inputs       []*ModuleInput    `json:"inputs"`
    61  	Outputs      []*ModuleOutput   `json:"outputs"`
    62  	Dependencies []*ModuleDep      `json:"dependencies"`
    63  	Resources    []*ModuleResource `json:"resources"`
    64  }
    65  
    66  // ModuleInput is an input for a module.
    67  type ModuleInput struct {
    68  	Name        string `json:"name"`
    69  	Description string `json:"description"`
    70  	Default     string `json:"default"`
    71  }
    72  
    73  // ModuleOutput is an output for a module.
    74  type ModuleOutput struct {
    75  	Name        string `json:"name"`
    76  	Description string `json:"description"`
    77  }
    78  
    79  // ModuleDep is an output for a module.
    80  type ModuleDep struct {
    81  	Name    string `json:"name"`
    82  	Source  string `json:"source"`
    83  	Version string `json:"version"`
    84  }
    85  
    86  // ModuleProviderDep is the output for a provider dependency
    87  type ModuleProviderDep struct {
    88  	Name    string `json:"name"`
    89  	Version string `json:"version"`
    90  }
    91  
    92  // ModuleResource is an output for a module.
    93  type ModuleResource struct {
    94  	Name string `json:"name"`
    95  	Type string `json:"type"`
    96  }