govendor: update `go-tfe`
This commit is contained in:
parent
617aaa6839
commit
5eb49f9df5
|
@ -31,6 +31,12 @@ type Organizations interface {
|
|||
|
||||
// Delete an organization by its name.
|
||||
Delete(ctx context.Context, organization string) error
|
||||
|
||||
// Capacity shows the current run capacity of an organization.
|
||||
Capacity(ctx context.Context, organization string) (*Capacity, error)
|
||||
|
||||
// RunQueue shows the current run queue of an organization.
|
||||
RunQueue(ctx context.Context, organization string, options RunQueueOptions) (*RunQueue, error)
|
||||
}
|
||||
|
||||
// organizations implements Organizations.
|
||||
|
@ -80,6 +86,19 @@ type Organization struct {
|
|||
TwoFactorConformant bool `jsonapi:"attr,two-factor-conformant"`
|
||||
}
|
||||
|
||||
// Capacity represents the current run capacity of an organization.
|
||||
type Capacity struct {
|
||||
Organization string `jsonapi:"primary,organization-capacity"`
|
||||
Pending int `jsonapi:"attr,pending"`
|
||||
Running int `jsonapi:"attr,running"`
|
||||
}
|
||||
|
||||
// RunQueue represents the current run queue of an organization.
|
||||
type RunQueue struct {
|
||||
*Pagination
|
||||
Items []*Run
|
||||
}
|
||||
|
||||
// OrganizationPermissions represents the organization permissions.
|
||||
type OrganizationPermissions struct {
|
||||
CanCreateTeam bool `json:"can-create-team"`
|
||||
|
@ -242,3 +261,50 @@ func (s *organizations) Delete(ctx context.Context, organization string) error {
|
|||
|
||||
return s.client.do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// Capacity shows the currently used capacity of an organization.
|
||||
func (s *organizations) Capacity(ctx context.Context, organization string) (*Capacity, error) {
|
||||
if !validStringID(&organization) {
|
||||
return nil, errors.New("Invalid value for organization")
|
||||
}
|
||||
|
||||
u := fmt.Sprintf("organizations/%s/capacity", url.QueryEscape(organization))
|
||||
req, err := s.client.newRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c := &Capacity{}
|
||||
err = s.client.do(ctx, req, c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// RunQueueOptions represents the options for showing the queue.
|
||||
type RunQueueOptions struct {
|
||||
ListOptions
|
||||
}
|
||||
|
||||
// RunQueue shows the current run queue of an organization.
|
||||
func (s *organizations) RunQueue(ctx context.Context, organization string, options RunQueueOptions) (*RunQueue, error) {
|
||||
if !validStringID(&organization) {
|
||||
return nil, errors.New("Invalid value for organization")
|
||||
}
|
||||
|
||||
u := fmt.Sprintf("organizations/%s/runs/queue", url.QueryEscape(organization))
|
||||
req, err := s.client.newRequest("GET", u, &options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rq := &RunQueue{}
|
||||
err = s.client.do(ctx, req, rq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return rq, nil
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@ type Runs interface {
|
|||
// Cancel a run by its ID.
|
||||
Cancel(ctx context.Context, runID string, options RunCancelOptions) error
|
||||
|
||||
// Force-cancel a run by its ID.
|
||||
ForceCancel(ctx context.Context, runID string, options RunForceCancelOptions) error
|
||||
|
||||
// Discard a run by its ID.
|
||||
Discard(ctx context.Context, runID string, options RunDiscardOptions) error
|
||||
}
|
||||
|
@ -77,16 +80,18 @@ type RunList struct {
|
|||
|
||||
// Run represents a Terraform Enterprise run.
|
||||
type Run struct {
|
||||
ID string `jsonapi:"primary,runs"`
|
||||
Actions *RunActions `jsonapi:"attr,actions"`
|
||||
CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"`
|
||||
HasChanges bool `jsonapi:"attr,has-changes"`
|
||||
IsDestroy bool `jsonapi:"attr,is-destroy"`
|
||||
Message string `jsonapi:"attr,message"`
|
||||
Permissions *RunPermissions `jsonapi:"attr,permissions"`
|
||||
Source RunSource `jsonapi:"attr,source"`
|
||||
Status RunStatus `jsonapi:"attr,status"`
|
||||
StatusTimestamps *RunStatusTimestamps `jsonapi:"attr,status-timestamps"`
|
||||
ID string `jsonapi:"primary,runs"`
|
||||
Actions *RunActions `jsonapi:"attr,actions"`
|
||||
CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"`
|
||||
ForceCancelAvailableAt time.Time `jsonapi:"attr,force-cancel-available-at,iso8601"`
|
||||
HasChanges bool `jsonapi:"attr,has-changes"`
|
||||
IsDestroy bool `jsonapi:"attr,is-destroy"`
|
||||
Message string `jsonapi:"attr,message"`
|
||||
Permissions *RunPermissions `jsonapi:"attr,permissions"`
|
||||
PositionInQueue int `jsonapi:"attr,position-in-queue"`
|
||||
Source RunSource `jsonapi:"attr,source"`
|
||||
Status RunStatus `jsonapi:"attr,status"`
|
||||
StatusTimestamps *RunStatusTimestamps `jsonapi:"attr,status-timestamps"`
|
||||
|
||||
// Relations
|
||||
Apply *Apply `jsonapi:"relation,apply"`
|
||||
|
@ -98,9 +103,10 @@ type Run struct {
|
|||
|
||||
// RunActions represents the run actions.
|
||||
type RunActions struct {
|
||||
IsCancelable bool `json:"is-cancelable"`
|
||||
IsConfirmable bool `json:"is-confirmable"`
|
||||
IsDiscardable bool `json:"is-discardable"`
|
||||
IsCancelable bool `json:"is-cancelable"`
|
||||
IsConfirmable bool `json:"is-confirmable"`
|
||||
IsDiscardable bool `json:"is-discardable"`
|
||||
IsForceCancelable bool `json:"is-force-cancelable"`
|
||||
}
|
||||
|
||||
// RunPermissions represents the run permissions.
|
||||
|
@ -108,6 +114,7 @@ type RunPermissions struct {
|
|||
CanApply bool `json:"can-apply"`
|
||||
CanCancel bool `json:"can-cancel"`
|
||||
CanDiscard bool `json:"can-discard"`
|
||||
CanForceCancel bool `json:"can-force-cancel"`
|
||||
CanForceExecute bool `json:"can-force-execute"`
|
||||
}
|
||||
|
||||
|
@ -259,6 +266,27 @@ func (s *runs) Cancel(ctx context.Context, runID string, options RunCancelOption
|
|||
return s.client.do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// RunCancelOptions represents the options for force-canceling a run.
|
||||
type RunForceCancelOptions struct {
|
||||
// An optional comment explaining the reason for the force-cancel.
|
||||
Comment *string `json:"comment,omitempty"`
|
||||
}
|
||||
|
||||
// ForceCancel is used to forcefully cancel a run by its ID.
|
||||
func (s *runs) ForceCancel(ctx context.Context, runID string, options RunForceCancelOptions) error {
|
||||
if !validStringID(&runID) {
|
||||
return errors.New("Invalid value for run ID")
|
||||
}
|
||||
|
||||
u := fmt.Sprintf("runs/%s/actions/force-cancel", url.QueryEscape(runID))
|
||||
req, err := s.client.newRequest("POST", u, &options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return s.client.do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// RunDiscardOptions represents the options for discarding a run.
|
||||
type RunDiscardOptions struct {
|
||||
// An optional explanation for why the run was discarded.
|
||||
|
|
|
@ -72,6 +72,7 @@ type Workspace struct {
|
|||
WorkingDirectory string `jsonapi:"attr,working-directory"`
|
||||
|
||||
// Relations
|
||||
CurrentRun *Run `jsonapi:"relation,current-run"`
|
||||
Organization *Organization `jsonapi:"relation,organization"`
|
||||
SSHKey *SSHKey `jsonapi:"relation,ssh-key"`
|
||||
}
|
||||
|
|
|
@ -1804,10 +1804,10 @@
|
|||
"revisionTime": "2018-07-12T07:51:27Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "V2A92CHPEiPIsU4Wepl0ukznka8=",
|
||||
"checksumSHA1": "9EZuhp7LWTAVsTDpP9DzajjmJxg=",
|
||||
"path": "github.com/hashicorp/go-tfe",
|
||||
"revision": "cca0c15746d89219f9732f6c07d267827fef25cd",
|
||||
"revisionTime": "2018-09-20T19:42:22Z"
|
||||
"revision": "ed986a3b38aba4630ca6ae7dbc876eb0d0c95c57",
|
||||
"revisionTime": "2018-10-10T13:21:10Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "85XUnluYJL7F55ptcwdmN8eSOsk=",
|
||||
|
|
Loading…
Reference in New Issue