tfregistry

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new Client instance.

func (*Client) ModuleLatestForProvider

ModuleLatestForProvider returns the latest version of a module for a single provider. https://www.terraform.io/docs/registry/api.html#latest-version-for-a-specific-module-provider

func (*Client) ProviderLatest added in v0.4.2

func (c *Client) ProviderLatest(ctx context.Context, req *ProviderLatestRequest) (*ProviderLatestResponse, error)

ProviderLatest returns the latest version of a provider. This relies on a currently undocumented providers API endpoint which behaves exactly like the equivalent documented modules API endpoint. https://www.terraform.io/docs/registry/api.html#latest-version-for-a-specific-module-provider

func (*Client) ProviderPackageMetadata added in v0.7.0

ProviderPackageMetadata returns a package metadata of a provider. https://developer.hashicorp.com/terraform/internals/provider-registry-protocol#find-a-provider-package

type ModuleLatestForProviderRequest

type ModuleLatestForProviderRequest struct {
	// Namespace is a user name which owns the module.
	Namespace string `json:"namespace"`
	// Name is a name of the module.
	Name string `json:"name"`
	// Provider is a name of the provider.
	Provider string `json:"provider"`
}

ModuleLatestForProviderRequest is a request parameter for ModuleLatestForProvider(). https://www.terraform.io/docs/registry/api.html#latest-version-for-a-specific-module-provider

type ModuleLatestForProviderResponse

type ModuleLatestForProviderResponse struct {
	// Version is the latest version of the module for a specific provider.
	Version string `json:"version"`
	// Versions is a list of available versions.
	Versions []string `json:"versions"`
}

ModuleLatestForProviderResponse is a response data for ModuleLatestForProvider(). There are other response fields, but we define only those we need here.

type ModuleV1API

type ModuleV1API interface {
	// ModuleLatestForProvider returns the latest version of a module for a single provider.
	// https://www.terraform.io/docs/registry/api.html#latest-version-for-a-specific-module-provider
	ModuleLatestForProvider(ctx context.Context, req *ModuleLatestForProviderRequest) (*ModuleLatestForProviderResponse, error)
}

ModuleV1API is an interface for the module v1 service.

type ProviderLatestRequest added in v0.4.2

type ProviderLatestRequest struct {
	// Namespace is the name of a namespace, unique on a particular hostname, that can contain one or more providers that are somehow related. On the public Terraform Registry the "namespace" represents the organization that is packaging and distributing the provider.
	Namespace string `json:"namespace"`
	// Type is the provider type, like "azurerm", "aws", "google", "dns", etc. A provider type is unique within a particular hostname and namespace.
	Type string `json:"type"`
}

ProviderLatestRequest is a request parameter for ProviderLatest(). This relies on a currently undocumented providers API endpoint which behaves exactly like the equivalent documented modules API endpoint. https://www.terraform.io/docs/registry/api.html#latest-version-for-a-specific-module-provider

type ProviderLatestResponse added in v0.4.2

type ProviderLatestResponse struct {
	// Version is the latest version of the provider.
	Version string `json:"version"`
	// Versions is a list of available versions.
	Versions []string `json:"versions"`
}

ProviderLatestResponse is a response data for ProviderLatest(). There are other response fields, but we define only those we need here.

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 ProviderV1API added in v0.4.2

type ProviderV1API interface {
	// ProviderLatest returns the latest version of a provider.
	// This relies on a currently undocumented providers API endpoint which behaves exactly like the equivalent documented modules API endpoint.
	// https://www.terraform.io/docs/registry/api.html#latest-version-for-a-specific-module-provider
	ProviderLatest(ctx context.Context, req *ProviderLatestRequest) (*ProviderLatestResponse, error)

	// ProviderPackageMetadata returns a package metadata of a provider.
	// https://developer.hashicorp.com/terraform/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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL