github.com/bshelton229/agent@v3.5.4+incompatible/api/pipelines.go (about)

     1  package api
     2  
     3  import "fmt"
     4  
     5  // PipelinesService handles communication with the pipeline related methods of the
     6  // Buildkite Agent API.
     7  type PipelinesService struct {
     8  	client *Client
     9  }
    10  
    11  // Pipeline represents a Buildkite Agent API Pipeline
    12  type Pipeline struct {
    13  	UUID     string      `json:"uuid"`
    14  	Pipeline interface{} `json:"pipeline"`
    15  	Replace  bool        `json:"replace,omitempty"`
    16  }
    17  
    18  // Uploads the pipeline to the Buildkite Agent API. This request doesn't use JSON,
    19  // but a multi-part HTTP form upload
    20  func (cs *PipelinesService) Upload(jobId string, pipeline *Pipeline) (*Response, error) {
    21  	u := fmt.Sprintf("jobs/%s/pipelines", jobId)
    22  
    23  	req, err := cs.client.NewRequest("POST", u, pipeline)
    24  	if err != nil {
    25  		return nil, err
    26  	}
    27  
    28  	return cs.client.Do(req, nil)
    29  }