Documentation
¶
Index ¶
- type API
- type Client
- func (c *Client) ListModuleVersions(ctx context.Context, req *ListModuleVersionsRequest) (*ListModuleVersionsResponse, error)
- func (c *Client) ListProviderVersions(ctx context.Context, req *ListProviderVersionsRequest) (*ListProviderVersionsResponse, error)
- func (c *Client) ProviderPackageMetadata(ctx context.Context, req *ProviderPackageMetadataRequest) (*ProviderPackageMetadataResponse, error)
- type Config
- type ListModuleVersionsRequest
- type ListModuleVersionsResponse
- type ListProviderVersionsRequest
- type ListProviderVersionsResponse
- type ModuleV1API
- type ModuleVersion
- type ModuleVersions
- type ProviderPackageMetadataRequest
- type ProviderPackageMetadataResponse
- type ProviderPlatform
- type ProviderV1API
- type ProviderVersion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶ added in v0.9.0
type API interface { ModuleV1API ProviderV1API }
API is an interface which calls Terraform Registry API. This works for both Terraform and OpenTofu registries. This abstraction layer is needed for testing with mock.
type Client ¶
type Client struct { // BaseURL is a base url for API requests. Defaults to the public Terraform Registry API. BaseURL *url.URL // contains filtered or unexported fields }
Client manages communication with the Terraform Registry API.
func (*Client) ListModuleVersions ¶ added in v0.9.0
func (c *Client) ListModuleVersions(ctx context.Context, req *ListModuleVersionsRequest) (*ListModuleVersionsResponse, error)
ListModuleVersions returns all versions of a module for a single provider. This works for both Terraform and OpenTofu registries.
func (*Client) ListProviderVersions ¶ added in v0.9.0
func (c *Client) ListProviderVersions(ctx context.Context, req *ListProviderVersionsRequest) (*ListProviderVersionsResponse, error)
ListProviderVersions returns all versions of a provider. This works for both Terraform and OpenTofu registries.
func (*Client) ProviderPackageMetadata ¶ added in v0.7.0
func (c *Client) ProviderPackageMetadata(ctx context.Context, req *ProviderPackageMetadataRequest) (*ProviderPackageMetadataResponse, error)
ProviderPackageMetadata returns a package metadata of a provider. https://developer.hashicorp.com/terraform/internals/provider-registry-protocol#find-a-provider-package
type Config ¶ added in v0.9.0
type Config struct { // HTTPClient is a http client which communicates with the API. // If nil, a default client will be used. HTTPClient *http.Client // BaseURL is a URL for Terraform Registry API requests. // Defaults to the public Terraform Registry API. // We have not yet implemented registry authentication, // so private registries such as HCP Terraform are not yet supported. // BaseURL should always be specified with a trailing slash. BaseURL string }
Config is a set of configurations for TFRegistry client.
type ListModuleVersionsRequest ¶ added in v0.9.0
type ListModuleVersionsRequest struct { // The user or organization the module is owned by. Namespace string `json:"namespace"` // The name of the module. Name string `json:"name"` // The name of the provider. Provider string `json:"provider"` }
ListModuleVersionsRequest is a request parameter for the ListModuleVersions API.
type ListModuleVersionsResponse ¶ added in v0.9.0
type ListModuleVersionsResponse struct { // Modules is an array containing module information. // The first element contains the requested module. Modules []ModuleVersions `json:"modules"` }
ListModuleVersionsResponse is a response data for the ListModuleVersions API.
type ListProviderVersionsRequest ¶ added in v0.9.0
type ListProviderVersionsRequest struct { // The user or organization the provider is owned by. Namespace string `json:"namespace"` // The type name of the provider. Type string `json:"type"` }
ListProviderVersionsRequest is a request parameter for ListProviderVersions API.
type ListProviderVersionsResponse ¶ added in v0.9.0
type ListProviderVersionsResponse struct { // Versions is a list of available versions. Versions []ProviderVersion `json:"versions"` }
ListProviderVersionsResponse is a response data for ListProviderVersions API.
type ModuleV1API ¶
type ModuleV1API interface { // ListModuleVersions returns all versions of a module for a single provider. // This works for both Terraform and OpenTofu registries. // https://developer.hashicorp.com/terraform/registry/api-docs#list-available-versions-for-a-specific-module // https://opentofu.org/docs/internals/module-registry-protocol/#list-available-versions-for-a-specific-module ListModuleVersions(ctx context.Context, req *ListModuleVersionsRequest) (*ListModuleVersionsResponse, error) }
ModuleV1API is an interface for the module v1 service.
type ModuleVersion ¶ added in v0.9.0
type ModuleVersion struct { // Version is the version string. Version string `json:"version"` }
ModuleVersion represents a single version of a module.
type ModuleVersions ¶ added in v0.9.0
type ModuleVersions struct { // Versions is a list of available versions. Versions []ModuleVersion `json:"versions"` }
ModuleVersions represents version information for a module.
type ProviderPackageMetadataRequest ¶ added in v0.7.0
type ProviderPackageMetadataRequest struct { // (required): the namespace portion of the address of the requested provider. Namespace string `json:"namespace"` // (required): the type portion of the address of the requested provider. Type string `json:"type"` // (required): the version selected to download. Version string `json:"version"` // (required): a keyword identifying the operating system that the returned package should be compatible with, like "linux" or "darwin". OS string `json:"os"` // (required): a keyword identifying the CPU architecture that the returned package should be compatible with, like "amd64" or "arm". Arch string `json:"arch"` }
ProviderPackageMetadataRequest is a request parameter for ProviderPackageMetadata(). https://developer.hashicorp.com/terraform/internals/provider-registry-protocol#find-a-provider-package
type ProviderPackageMetadataResponse ¶ added in v0.7.0
type ProviderPackageMetadataResponse struct { // (required): the filename for this provider's zip archive as recorded in the "shasums" document, so that Terraform CLI can determine which of the given checksums should be used for this specific package. Filename string `json:"filename"` // (required): a URL from which Terraform can retrieve the provider's zip archive. If this is a relative URL then it will be resolved relative to the URL that returned the containing JSON object. DownloadURL string `json:"download_url"` // (required): the SHA256 checksum for this provider's zip archive as recorded in the shasums document. SHASum string `json:"shasum"` // (required): a URL from which Terraform can retrieve a text document recording expected SHA256 checksums for this package and possibly other packages for the same provider version on other platforms. SHASumsURL string `json:"shasums_url"` }
ProviderPackageMetadataResponse is a response data for ProviderPackageMetadata(). There are other response fields, but we define only those we need here.
type ProviderPlatform ¶ added in v0.9.0
type ProviderPlatform struct { // OS is the operating system. OS string `json:"os"` // Arch is the architecture. Arch string `json:"arch"` }
ProviderPlatform represents a platform supported by a provider version.
type ProviderV1API ¶ added in v0.4.2
type ProviderV1API interface { // ListProviderVersions returns all versions of a provider. // This works for both Terraform and OpenTofu registries. // https://developer.hashicorp.com/terraform/internals/provider-registry-protocol#list-available-versions // https://opentofu.org/docs/internals/provider-registry-protocol/#list-available-versions ListProviderVersions(ctx context.Context, req *ListProviderVersionsRequest) (*ListProviderVersionsResponse, error) // ProviderPackageMetadata returns a package metadata of a provider. // https://developer.hashicorp.com/terraform/internals/provider-registry-protocol#find-a-provider-package // https://opentofu.org/docs/internals/provider-registry-protocol/#find-a-provider-package ProviderPackageMetadata(ctx context.Context, req *ProviderPackageMetadataRequest) (*ProviderPackageMetadataResponse, error) }
ProviderV1API is an interface for the provider v1 service.
type ProviderVersion ¶ added in v0.9.0
type ProviderVersion struct { // Version is the version string. Version string `json:"version"` // Protocols is a list of supported protocol versions. Protocols []string `json:"protocols,omitempty"` // Platforms is a list of supported platforms. Platforms []ProviderPlatform `json:"platforms,omitempty"` }
ProviderVersion represents a single version of a provider.