github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/internal/getproviders/http_mirror_source.go (about)

     1  package getproviders
     2  
     3  import (
     4  	"net/url"
     5  
     6  	"github.com/hashicorp/terraform/addrs"
     7  )
     8  
     9  // HTTPMirrorSource is a source that reads provider metadata from a provider
    10  // mirror that is accessible over the HTTP provider mirror protocol.
    11  type HTTPMirrorSource struct {
    12  	baseURL *url.URL
    13  }
    14  
    15  var _ Source = (*HTTPMirrorSource)(nil)
    16  
    17  // NewHTTPMirrorSource constructs and returns a new network mirror source with
    18  // the given base URL. The relative URL offsets defined by the HTTP mirror
    19  // protocol will be resolve relative to the given URL.
    20  func NewHTTPMirrorSource(baseURL *url.URL) *HTTPMirrorSource {
    21  	return &HTTPMirrorSource{
    22  		baseURL: baseURL,
    23  	}
    24  }
    25  
    26  // AvailableVersions retrieves the available versions for the given provider
    27  // from the object's underlying HTTP mirror service.
    28  func (s *HTTPMirrorSource) AvailableVersions(provider addrs.Provider) (VersionList, error) {
    29  	// TODO: Implement
    30  	panic("HTTPMirrorSource.AvailableVersions not yet implemented")
    31  }
    32  
    33  // PackageMeta retrieves metadata for the requested provider package
    34  // from the object's underlying HTTP mirror service.
    35  func (s *HTTPMirrorSource) PackageMeta(provider addrs.Provider, version Version, target Platform) (PackageMeta, error) {
    36  	// TODO: Implement
    37  	panic("HTTPMirrorSource.PackageMeta not yet implemented")
    38  }