code: func (c *Client) TerraformProviderLocation(provider *regsrc.TerraformProvider, version string) (*response.TerraformProviderPlatformLocation, error) {
  	host, err := provider.SvcHost()
  	if err != nil {
  		return nil, err
  	}
  
  	service, err := c.Discover(host, providersServiceID)
  	if err != nil {
  		return nil, err
  	}
  
  	p, err := url.Parse(path.Join(
  		provider.TerraformProvider(),
  		version,
  		"download",
  		provider.OS,
  		provider.Arch,
  	))
  	if err != nil {
  		return nil, err
  	}
  
  	service = service.ResolveReference(p)
  
  	log.Printf("[DEBUG] fetching provider location from %q", service)
  
  	req, err := http.NewRequest("GET", service.String(), nil)
  	if err != nil {
  		return nil, err
  	}
  
  	c.addRequestCreds(host, req)
  	req.Header.Set(xTerraformVersion, tfVersion)
  
  	resp, err := c.client.Do(req)
  	if err != nil {
  		return nil, err
  	}
  	defer resp.Body.Close()
  
  	var loc response.TerraformProviderPlatformLocation
  
  	dec := json.NewDecoder(resp.Body)
  	if err := dec.Decode(&loc); err != nil {
  		return nil, err
  	}
  
  	switch resp.StatusCode {
  	case http.StatusOK, http.StatusNoContent:
  		// OK
  	case http.StatusNotFound:
  		return nil, fmt.Errorf("provider %q version %q not found", provider.TerraformProvider(), version)
  	default:
  		// anything else is an error:
  		return nil, fmt.Errorf("error getting download location for %q: %s", provider.TerraformProvider(), resp.Status)
  	}
  
  	return &loc, nil
  }
docs: // TerraformProviderLocation queries the registry for a provider download metadata