github.com/GoogleCloudPlatform/terraformer@v0.8.18/providers/octopusdeploy/octopusdeploy_service.go (about)

     1  package octopusdeploy
     2  
     3  import (
     4  	"errors"
     5  	"net/http"
     6  
     7  	"github.com/GoogleCloudPlatform/terraformer/terraformutils"
     8  	"github.com/OctopusDeploy/go-octopusdeploy/octopusdeploy"
     9  )
    10  
    11  type OctopusDeployService struct { //nolint
    12  	terraformutils.Service
    13  }
    14  
    15  func (s *OctopusDeployService) Client() (*octopusdeploy.Client, error) {
    16  	octopusURL := s.Args["address"].(string)
    17  	octopusAPIKey := s.Args["apikey"].(string)
    18  
    19  	if octopusURL == "" || octopusAPIKey == "" {
    20  		err := errors.New("Please make sure to set the env variables 'OCTOPUS_CLI_SERVER' and 'OCTOPUS_CLI_API_KEY'")
    21  		return nil, err
    22  	}
    23  
    24  	httpClient := http.Client{}
    25  	client := octopusdeploy.NewClient(&httpClient, octopusURL, octopusAPIKey)
    26  
    27  	return client, nil
    28  }