forked from drone/go-scm
-
Notifications
You must be signed in to change notification settings - Fork 83
/
deploy.go
95 lines (83 loc) · 2.95 KB
/
deploy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package scm
import (
"context"
"time"
)
type (
// Deployment represents a request to deploy a version/ref/sha in some environment
Deployment struct {
ID string
Namespace string
Name string
Link string
Sha string
Ref string
Task string
FullName string
Description string
OriginalEnvironment string
Environment string
RepositoryLink string
StatusLink string
Author *User
Created time.Time
Updated time.Time
TransientEnvironment bool
ProductionEnvironment bool
Payload interface{}
}
// DeploymentInput the input to create a new deployment
DeploymentInput struct {
Ref string
Task string
Payload string
Environment string
Description string
RequiredContexts []string
AutoMerge bool
TransientEnvironment bool
ProductionEnvironment bool
}
// DeploymentStatus represents the status of a deployment
DeploymentStatus struct {
ID string
State string
Author *User
Description string
Environment string
DeploymentLink string
EnvironmentLink string
LogLink string
RepositoryLink string
TargetLink string
Created time.Time
Updated time.Time
}
// DeploymentStatusInput the input to creating a status of a deployment
DeploymentStatusInput struct {
State string
TargetLink string
LogLink string
Description string
Environment string
EnvironmentLink string
AutoInactive bool
}
// DeploymentService a service for working with deployments and deployment services
DeploymentService interface {
// Find find a deployment by id.
Find(ctx context.Context, repoFullName string, deploymentID string) (*Deployment, *Response, error)
// List returns a list of deployments.
List(ctx context.Context, repoFullName string, opts *ListOptions) ([]*Deployment, *Response, error)
// Create creates a new deployment.
Create(ctx context.Context, repoFullName string, deployment *DeploymentInput) (*Deployment, *Response, error)
// Delete deletes a deployment.
Delete(ctx context.Context, repoFullName string, deploymentID string) (*Response, error)
// FindStatus find a deployment status by id.
FindStatus(ctx context.Context, repoFullName string, deploymentID string, statusID string) (*DeploymentStatus, *Response, error)
// List returns a list of deployments.
ListStatus(ctx context.Context, repoFullName string, deploymentID string, options *ListOptions) ([]*DeploymentStatus, *Response, error)
// Create creates a new deployment.
CreateStatus(ctx context.Context, repoFullName string, deploymentID string, deployment *DeploymentStatusInput) (*DeploymentStatus, *Response, error)
}
)