Documentation
¶
Index ¶
- func CreateTarball(path string, w io.Writer) (string, error)
- func PublishStep(ps Publisher, manifest *StepManifest, tarball io.Reader, ...) error
- func ValidateManifest(manifest *StepManifest) error
- type PublishStepRequest
- type PublishStepResponse
- type Publisher
- type RESTPublisher
- type Step
- type StepManifest
- type StepProperty
- type StepVersion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTarball ¶
CreateTarball will create a step tarball based on path.
func PublishStep ¶
func PublishStep(ps Publisher, manifest *StepManifest, tarball io.Reader, username, checksum string, size int64, private bool) error
PublishStep uses ps to create a new step using manifest, tarball.
func ValidateManifest ¶
func ValidateManifest(manifest *StepManifest) error
ValidateManifest checks for some common issues, before sending the manifest to the Wercker steps server.
Types ¶
type PublishStepRequest ¶
type PublishStepRequest struct { // checksum of the tarball containing the step Checksum string `json:"checksum,omitempty"` // size of the tarball containing the step Size int64 `json:"size,omitempty"` // manifest contains the manifest of the step Manifest *StepManifest `json:"manifest,omitempty"` // username Username string `json:"username,omitempty"` // specifies whether the step is private or public Private bool `json:"private,omitempty"` }
type PublishStepResponse ¶
type PublishStepResponse struct { // uploadUrl is the URL the client has to post the tarball to UploadUrl string `json:"uploadUrl,omitempty"` // token is the token to send to the done endpoint to notify the upload has // been finished Token string `json:"token,omitempty"` // expires is the expiration date of the uploadUrl Expires string `json:"expires,omitempty"` }
type Publisher ¶
type Publisher interface { // CreateDraft implements the first step of the publication flow. It requires // a manifest, the checksum and size of the tarball. CreateDraft(req *PublishStepRequest) (*PublishStepResponse, error) // UploadTarball uploads the step tarball using the response from the // CreateDraft endpoint. UploadTarball(uploadURL string, body io.Reader, size int64) error // FinishPublish post to the publish endpoint and the tarball is uploaded to // indicate that the step can be published. FinishPublish(token string) error }
Publisher contains the steps to publish a step.
type RESTPublisher ¶
type RESTPublisher struct {
// contains filtered or unexported fields
}
RESTPublisher contains the steps to publish a step.
func NewRESTPublisher ¶
func NewRESTPublisher(endpoint string, client *http.Client, stepsClient *http.Client) *RESTPublisher
NewRESTPublisher creates a publisher that uses the REST API.
func (*RESTPublisher) CreateDraft ¶
func (s *RESTPublisher) CreateDraft(createDraftRequest *PublishStepRequest) (*PublishStepResponse, error)
CreateDraft implements the first step of the publication flow. It requires a manifest, the checksum and size of the tarball.
func (*RESTPublisher) FinishPublish ¶
func (s *RESTPublisher) FinishPublish(token string) error
FinishPublish post to the publish endpoint and the tarball is uploaded to indicate that the step can be published.
func (*RESTPublisher) UploadTarball ¶
UploadTarball uploads the step tarball using the response from the CreateDraft endpoint.
type Step ¶
type Step struct { // owner is the user owning the step Owner string `json:"owner,omitempty"` // name of the step Name string `json:"name,omitempty"` // version of the step Version *StepVersion `json:"version,omitempty"` // summary of the step. Should never exceed 140 characters Summary string `json:"summary,omitempty"` // tags of the step Tags []string `json:"tags,omitempty"` // checksum of the tarball containing the step Checksum string `json:"checksum,omitempty"` // size of the tarball containing the step Size int64 `json:"size,omitempty"` // license of the step License string `json:"license,omitempty"` // properties of the step Properties []*StepProperty `json:"properties,omitempty"` // repository of the step. URL where to find the source of the step Repository string `json:"repository,omitempty"` // tarballUrl points to the step download link TarballURL string `json:"tarballUrl,omitempty"` // readmeUrl point to the step README ReadmeURL string `json:"readmeUrl,omitempty"` }
type StepManifest ¶
type StepManifest struct { // name of the step Name string `json:"name,omitempty"` // version of the step Version string `json:"version,omitempty"` // summary of the step Summary string `json:"summary,omitempty"` // tags of the step Tags []string `json:"tags,omitempty"` // properties of the step Properties []*StepProperty `json:"properties,omitempty"` }
func ParseManifest ¶
func ParseManifest(b []byte) (*StepManifest, error)
ParseManifest parse b as a StepManifest.
func ParseManifestReader ¶
func ParseManifestReader(r io.Reader) (*StepManifest, error)
ParseManifestReader first reads all of r into memory before using ParseManifest to unmarshall the content.
type StepProperty ¶
type StepProperty struct { // name of the property Name string `json:"name,omitempty"` // type of the property Type string `json:"type,omitempty"` // required whether the property is required or not Required bool `json:"required,omitempty"` // default property Default string `json:"default,omitempty"` }