models

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package models provides the data structures used to represent Terraform providers and their details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Platform

type Platform struct {
	OS   string `json:"os"`
	Arch string `json:"arch"`
}

func (Platform) String

func (platform Platform) String() string

type Platforms

type Platforms []*Platform

type Provider

type Provider struct {
	*ResponseBody

	RegistryName string
	Namespace    string
	Name         string
	Version      string
	OS           string
	Arch         string

	// OriginalConstraints holds the version constraints from the module's required_providers block
	OriginalConstraints string
}

Provider represents the details of the Terraform provider.

func ParseProvider

func ParseProvider(str string) *Provider

func (*Provider) Address

func (provider *Provider) Address() string

func (*Provider) Constraints

func (provider *Provider) Constraints() string

func (*Provider) Match

func (provider *Provider) Match(target *Provider) bool

Match returns true if all defined provider properties are matched.

func (*Provider) Platform

func (provider *Provider) Platform() string

func (*Provider) String

func (provider *Provider) String() string

type Providers

type Providers []*Provider

func ParseProviders

func ParseProviders(strs ...string) Providers

func (Providers) Find

func (providers Providers) Find(target *Provider) *Provider

type ResponseBody

type ResponseBody struct {
	Platform

	Protocols []string `json:"protocols,omitempty"`
	Filename  string   `json:"filename"`

	DownloadURL            string `json:"download_url"`
	SHA256SumsURL          string `json:"shasums_url,omitempty"`
	SHA256SumsSignatureURL string `json:"shasums_signature_url,omitempty"`

	SHA256Sum   string         `json:"shasum,omitempty"`
	SigningKeys SigningKeyList `json:"signing_keys"`
}

ResponseBody represents the details of the Terraform provider received from a registry.

func (*ResponseBody) ResolveRelativeReferences

func (body *ResponseBody) ResolveRelativeReferences(base *url.URL) *ResponseBody

type SigningKey

type SigningKey struct {
	ASCIIArmor     string `json:"ascii_armor"`
	TrustSignature string `json:"trust_signature"`
}

SigningKey represents a key used to sign packages from a registry, along with an optional trust signature from the registry operator. These are both in ASCII armored OpenPGP format.

type SigningKeyList

type SigningKeyList struct {
	GPGPublicKeys []*SigningKey `json:"gpg_public_keys"`
}

func (SigningKeyList) Keys

func (list SigningKeyList) Keys() map[string]string

type Version

type Version struct {
	Version   string    `json:"version"`
	Protocols []string  `json:"protocols"`
	Platforms Platforms `json:"platforms"`
}

func (Version) String

func (version Version) String() string

type Versions

type Versions []*Version

func (Versions) FilterValid added in v1.0.0

func (versions Versions) FilterValid() (Versions, []string)

FilterValid returns only versions with valid semver strings that conform to the Terraform registry protocol (no "v" prefix, no empty strings). The second return value contains the invalid version strings that were filtered out.

Jump to

Keyboard shortcuts

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