Debian Codegraph @

v5/heroku.go

raw
1 // Generated service client for heroku API.
2 //
3 // To be able to interact with this API, you have to
4 // create a new service:
5 //
6 // s := heroku.NewService(nil)
7 //
8 // The Service struct has all the methods you need
9 // to interact with heroku API.
10 //
11 package v5
12
13 import (
14 "bytes"
15 "context"
16 "encoding/json"
17 "fmt"
18 "github.com/google/go-querystring/query"
19 "io"
20 "net/http"
21 "reflect"
22 "runtime"
23 "strings"
24 "time"
25 )
26
27 var _ = time.Second
28
29 const (
30 Version = "v5"
31 DefaultUserAgent = "heroku/" + Version + " (" + runtime.GOOS + "; " + runtime.GOARCH + ")"
32 DefaultURL = "https://api.heroku.com"
33 )
34
35 // Service represents your API.
36 type Service struct {
37 client *http.Client
38 URL string
39 }
40
41 // NewService creates a Service using the given, if none is provided
42 // it uses http.DefaultClient.
43 func NewService(c *http.Client) *Service {
44 if c == nil {
45 c = http.DefaultClient
46 }
47 return &Service{
48 client: c,
49 URL: DefaultURL,
50 }
51 }
52
53 // NewRequest generates an HTTP request, but does not perform the request.
54 func (s *Service) NewRequest(ctx context.Context, method, path string, body interface{}, q interface{}) (*http.Request, error) {
55 var ctype string
56 var rbody io.Reader
57 switch t := body.(type) {
58 case nil:
59 case string:
60 rbody = bytes.NewBufferString(t)
61 case io.Reader:
62 rbody = t
63 default:
64 v := reflect.ValueOf(body)
65 if !v.IsValid() {
66 break
67 }
68 if v.Type().Kind() == reflect.Ptr {
69 v = reflect.Indirect(v)
70 if !v.IsValid() {
71 break
72 }
73 }
74 j, err := json.Marshal(body)
75 if err != nil {
76 return nil, err
77 }
78 rbody = bytes.NewReader(j)
79 ctype = "application/json"
80 }
81 req, err := http.NewRequest(method, s.URL+path, rbody)
82 if err != nil {
83 return nil, err
84 }
85 req = req.WithContext(ctx)
86 if q != nil {
87 v, err := query.Values(q)
88 if err != nil {
89 return nil, err
90 }
91 query := v.Encode()
92 if req.URL.RawQuery != "" && query != "" {
93 req.URL.RawQuery += "&"
94 }
95 req.URL.RawQuery += query
96 }
97 req.Header.Set("Accept", "application/json")
98 req.Header.Set("User-Agent", DefaultUserAgent)
99 if ctype != "" {
100 req.Header.Set("Content-Type", ctype)
101 }
102 return req, nil
103 }
104
105 // Do sends a request and decodes the response into v.
106 func (s *Service) Do(ctx context.Context, v interface{}, method, path string, body interface{}, q interface{}, lr *ListRange) error {
107 req, err := s.NewRequest(ctx, method, path, body, q)
108 if err != nil {
109 return err
110 }
111 if lr != nil {
112 lr.SetHeader(req)
113 }
114 resp, err := s.client.Do(req)
115 if err != nil {
116 return err
117 }
118 defer resp.Body.Close()
119 switch t := v.(type) {
120 case nil:
121 case io.Writer:
122 _, err = io.Copy(t, resp.Body)
123 default:
124 err = json.NewDecoder(resp.Body).Decode(v)
125 }
126 return err
127 }
128
129 // Get sends a GET request and decodes the response into v.
130 func (s *Service) Get(ctx context.Context, v interface{}, path string, query interface{}, lr *ListRange) error {
131 return s.Do(ctx, v, "GET", path, nil, query, lr)
132 }
133
134 // Patch sends a Path request and decodes the response into v.
135 func (s *Service) Patch(ctx context.Context, v interface{}, path string, body interface{}) error {
136 return s.Do(ctx, v, "PATCH", path, body, nil, nil)
137 }
138
139 // Post sends a POST request and decodes the response into v.
140 func (s *Service) Post(ctx context.Context, v interface{}, path string, body interface{}) error {
141 return s.Do(ctx, v, "POST", path, body, nil, nil)
142 }
143
144 // Put sends a PUT request and decodes the response into v.
145 func (s *Service) Put(ctx context.Context, v interface{}, path string, body interface{}) error {
146 return s.Do(ctx, v, "PUT", path, body, nil, nil)
147 }
148
149 // Delete sends a DELETE request.
150 func (s *Service) Delete(ctx context.Context, v interface{}, path string) error {
151 return s.Do(ctx, v, "DELETE", path, nil, nil, nil)
152 }
153
154 // ListRange describes a range.
155 type ListRange struct {
156 Field string
157 Max int
158 Descending bool
159 FirstID string
160 LastID string
161 }
162
163 // SetHeader set headers on the given Request.
164 func (lr *ListRange) SetHeader(req *http.Request) {
165 var hdrval string
166 if lr.Field != "" {
167 hdrval += lr.Field + " "
168 }
169 hdrval += lr.FirstID + ".." + lr.LastID
170 params := make([]string, 0, 2)
171 if lr.Max != 0 {
172 params = append(params, fmt.Sprintf("max=%d", lr.Max))
173 }
174 if lr.Descending {
175 params = append(params, "order=desc")
176 }
177 if len(params) > 0 {
178 hdrval += fmt.Sprintf("; %s", strings.Join(params, ","))
179 }
180 req.Header.Set("Range", hdrval)
181 return
182 }
183
184 // Bool allocates a new int value returns a pointer to it.
185 func Bool(v bool) *bool {
186 p := new(bool)
187 *p = v
188 return p
189 }
190
191 // Int allocates a new int value returns a pointer to it.
192 func Int(v int) *int {
193 p := new(int)
194 *p = v
195 return p
196 }
197
198 // Float64 allocates a new float64 value returns a pointer to it.
199 func Float64(v float64) *float64 {
200 p := new(float64)
201 *p = v
202 return p
203 }
204
205 // String allocates a new string value returns a pointer to it.
206 func String(v string) *string {
207 p := new(string)
208 *p = v
209 return p
210 }
211
212 // An account represents an individual signed up to use the Heroku
213 // platform.
214 type Account struct {
215 AllowTracking bool `json:"allow_tracking" url:"allow_tracking,key"` // whether to allow third party web activity tracking
216 Beta bool `json:"beta" url:"beta,key"` // whether allowed to utilize beta Heroku features
217 CountryOfResidence *string `json:"country_of_residence" url:"country_of_residence,key"` // country where account owner resides
218 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when account was created
219 DefaultOrganization *struct {
220 ID string `json:"id" url:"id,key"` // unique identifier of team
221 Name string `json:"name" url:"name,key"` // unique name of team
222 } `json:"default_organization" url:"default_organization,key"` // team selected by default
223 DefaultTeam *struct {
224 ID string `json:"id" url:"id,key"` // unique identifier of team
225 Name string `json:"name" url:"name,key"` // unique name of team
226 } `json:"default_team" url:"default_team,key"` // team selected by default
227 DelinquentAt *time.Time `json:"delinquent_at" url:"delinquent_at,key"` // when account became delinquent
228 Email string `json:"email" url:"email,key"` // unique email address of account
229 Federated bool `json:"federated" url:"federated,key"` // whether the user is federated and belongs to an Identity Provider
230 ID string `json:"id" url:"id,key"` // unique identifier of an account
231 IdentityProvider *struct {
232 ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
233 Name string `json:"name" url:"name,key"` // user-friendly unique identifier for this identity provider
234 Organization struct {
235 Name string `json:"name" url:"name,key"` // unique name of team
236 } `json:"organization" url:"organization,key"`
237 Owner struct {
238 ID string `json:"id" url:"id,key"` // unique identifier of the owner
239 Name string `json:"name" url:"name,key"` // name of the owner
240 Type string `json:"type" url:"type,key"` // type of the owner
241 } `json:"owner" url:"owner,key"` // entity that owns this identity provider
242 Team struct {
243 Name string `json:"name" url:"name,key"` // unique name of team
244 } `json:"team" url:"team,key"`
245 } `json:"identity_provider" url:"identity_provider,key"` // Identity Provider details for federated users.
246 LastLogin *time.Time `json:"last_login" url:"last_login,key"` // when account last authorized with Heroku
247 Name *string `json:"name" url:"name,key"` // full name of the account owner
248 SmsNumber *string `json:"sms_number" url:"sms_number,key"` // SMS number of account
249 SuspendedAt *time.Time `json:"suspended_at" url:"suspended_at,key"` // when account was suspended
250 TwoFactorAuthentication bool `json:"two_factor_authentication" url:"two_factor_authentication,key"` // whether two-factor auth is enabled on the account
251 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when account was updated
252 Verified bool `json:"verified" url:"verified,key"` // whether account has been verified with billing information
253 }
254
255 // Info for account.
256 func (s *Service) AccountInfo(ctx context.Context) (*Account, error) {
257 var account Account
258 return &account, s.Get(ctx, &account, fmt.Sprintf("/account"), nil, nil)
259 }
260
261 type AccountUpdateOpts struct {
262 AllowTracking *bool `json:"allow_tracking,omitempty" url:"allow_tracking,omitempty,key"` // whether to allow third party web activity tracking
263 Beta *bool `json:"beta,omitempty" url:"beta,omitempty,key"` // whether allowed to utilize beta Heroku features
264 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // full name of the account owner
265 }
266
267 // Update account.
268 func (s *Service) AccountUpdate(ctx context.Context, o AccountUpdateOpts) (*Account, error) {
269 var account Account
270 return &account, s.Patch(ctx, &account, fmt.Sprintf("/account"), o)
271 }
272
273 // Delete account. Note that this action cannot be undone. Note: This
274 // endpoint requires the HTTP_HEROKU_PASSWORD or
275 // HTTP_HEROKU_PASSWORD_BASE64 header be set correctly for the user
276 // account.
277 func (s *Service) AccountDelete(ctx context.Context) (*Account, error) {
278 var account Account
279 return &account, s.Delete(ctx, &account, fmt.Sprintf("/account"))
280 }
281
282 // Info for account.
283 func (s *Service) AccountInfoByUser(ctx context.Context, accountIdentity string) (*Account, error) {
284 var account Account
285 return &account, s.Get(ctx, &account, fmt.Sprintf("/users/%v", accountIdentity), nil, nil)
286 }
287
288 type AccountUpdateByUserOpts struct {
289 AllowTracking *bool `json:"allow_tracking,omitempty" url:"allow_tracking,omitempty,key"` // whether to allow third party web activity tracking
290 Beta *bool `json:"beta,omitempty" url:"beta,omitempty,key"` // whether allowed to utilize beta Heroku features
291 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // full name of the account owner
292 }
293
294 // Update account.
295 func (s *Service) AccountUpdateByUser(ctx context.Context, accountIdentity string, o AccountUpdateByUserOpts) (*Account, error) {
296 var account Account
297 return &account, s.Patch(ctx, &account, fmt.Sprintf("/users/%v", accountIdentity), o)
298 }
299
300 // Delete account. Note that this action cannot be undone. Note: This
301 // endpoint requires the HTTP_HEROKU_PASSWORD or
302 // HTTP_HEROKU_PASSWORD_BASE64 header be set correctly for the user
303 // account.
304 func (s *Service) AccountDeleteByUser(ctx context.Context, accountIdentity string) (*Account, error) {
305 var account Account
306 return &account, s.Delete(ctx, &account, fmt.Sprintf("/users/%v", accountIdentity))
307 }
308
309 // An account feature represents a Heroku labs capability that can be
310 // enabled or disabled for an account on Heroku.
311 type AccountFeature struct {
312 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when account feature was created
313 Description string `json:"description" url:"description,key"` // description of account feature
314 DisplayName string `json:"display_name" url:"display_name,key"` // user readable feature name
315 DocURL string `json:"doc_url" url:"doc_url,key"` // documentation URL of account feature
316 Enabled bool `json:"enabled" url:"enabled,key"` // whether or not account feature has been enabled
317 FeedbackEmail string `json:"feedback_email" url:"feedback_email,key"` // e-mail to send feedback about the feature
318 ID string `json:"id" url:"id,key"` // unique identifier of account feature
319 Name string `json:"name" url:"name,key"` // unique name of account feature
320 State string `json:"state" url:"state,key"` // state of account feature
321 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when account feature was updated
322 }
323
324 // Info for an existing account feature.
325 func (s *Service) AccountFeatureInfo(ctx context.Context, accountFeatureIdentity string) (*AccountFeature, error) {
326 var accountFeature AccountFeature
327 return &accountFeature, s.Get(ctx, &accountFeature, fmt.Sprintf("/account/features/%v", accountFeatureIdentity), nil, nil)
328 }
329
330 type AccountFeatureListResult []AccountFeature
331
332 // List existing account features.
333 func (s *Service) AccountFeatureList(ctx context.Context, lr *ListRange) (AccountFeatureListResult, error) {
334 var accountFeature AccountFeatureListResult
335 return accountFeature, s.Get(ctx, &accountFeature, fmt.Sprintf("/account/features"), nil, lr)
336 }
337
338 type AccountFeatureUpdateOpts struct {
339 Enabled bool `json:"enabled" url:"enabled,key"` // whether or not account feature has been enabled
340 }
341
342 // Update an existing account feature.
343 func (s *Service) AccountFeatureUpdate(ctx context.Context, accountFeatureIdentity string, o AccountFeatureUpdateOpts) (*AccountFeature, error) {
344 var accountFeature AccountFeature
345 return &accountFeature, s.Patch(ctx, &accountFeature, fmt.Sprintf("/account/features/%v", accountFeatureIdentity), o)
346 }
347
348 // Add-ons represent add-ons that have been provisioned and attached to
349 // one or more apps.
350 type AddOn struct {
351 Actions []struct{} `json:"actions" url:"actions,key"` // provider actions for this specific add-on
352 AddonService struct {
353 ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
354 Name string `json:"name" url:"name,key"` // unique name of this add-on-service
355 } `json:"addon_service" url:"addon_service,key"` // identity of add-on service
356 App struct {
357 ID string `json:"id" url:"id,key"` // unique identifier of app
358 Name string `json:"name" url:"name,key"` // unique name of app
359 } `json:"app" url:"app,key"` // billing application associated with this add-on
360 BilledPrice *struct {
361 Cents int `json:"cents" url:"cents,key"` // price in cents per unit of plan
362 Contract bool `json:"contract" url:"contract,key"` // price is negotiated in a contract outside of monthly add-on billing
363 Unit string `json:"unit" url:"unit,key"` // unit of price for plan
364 } `json:"billed_price" url:"billed_price,key"` // billed price
365 BillingEntity struct {
366 ID string `json:"id" url:"id,key"` // unique identifier of the billing entity
367 Name string `json:"name" url:"name,key"` // name of the billing entity
368 Type string `json:"type" url:"type,key"` // type of Object of the billing entity; new types allowed at any time.
369 } `json:"billing_entity" url:"billing_entity,key"` // billing entity associated with this add-on
370 ConfigVars []string `json:"config_vars" url:"config_vars,key"` // config vars exposed to the owning app by this add-on
371 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on was created
372 ID string `json:"id" url:"id,key"` // unique identifier of add-on
373 Name string `json:"name" url:"name,key"` // globally unique name of the add-on
374 Plan struct {
375 ID string `json:"id" url:"id,key"` // unique identifier of this plan
376 Name string `json:"name" url:"name,key"` // unique name of this plan
377 } `json:"plan" url:"plan,key"` // identity of add-on plan
378 ProviderID string `json:"provider_id" url:"provider_id,key"` // id of this add-on with its provider
379 State string `json:"state" url:"state,key"` // state in the add-on's lifecycle
380 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on was updated
381 WebURL *string `json:"web_url" url:"web_url,key"` // URL for logging into web interface of add-on (e.g. a dashboard)
382 }
383 type AddOnListResult []AddOn
384
385 // List all existing add-ons.
386 func (s *Service) AddOnList(ctx context.Context, lr *ListRange) (AddOnListResult, error) {
387 var addOn AddOnListResult
388 return addOn, s.Get(ctx, &addOn, fmt.Sprintf("/addons"), nil, lr)
389 }
390
391 // Info for an existing add-on.
392 func (s *Service) AddOnInfo(ctx context.Context, addOnIdentity string) (*AddOn, error) {
393 var addOn AddOn
394 return &addOn, s.Get(ctx, &addOn, fmt.Sprintf("/addons/%v", addOnIdentity), nil, nil)
395 }
396
397 type AddOnCreateOpts struct {
398 Attachment *struct {
399 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name for this add-on attachment to this app
400 } `json:"attachment,omitempty" url:"attachment,omitempty,key"` // name for add-on's initial attachment
401 Config map[string]string `json:"config,omitempty" url:"config,omitempty,key"` // custom add-on provisioning options
402 Confirm *string `json:"confirm,omitempty" url:"confirm,omitempty,key"` // name of billing entity for confirmation
403 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // globally unique name of the add-on
404 Plan string `json:"plan" url:"plan,key"` // unique identifier of this plan
405 }
406
407 // Create a new add-on.
408 func (s *Service) AddOnCreate(ctx context.Context, appIdentity string, o AddOnCreateOpts) (*AddOn, error) {
409 var addOn AddOn
410 return &addOn, s.Post(ctx, &addOn, fmt.Sprintf("/apps/%v/addons", appIdentity), o)
411 }
412
413 // Delete an existing add-on.
414 func (s *Service) AddOnDelete(ctx context.Context, appIdentity string, addOnIdentity string) (*AddOn, error) {
415 var addOn AddOn
416 return &addOn, s.Delete(ctx, &addOn, fmt.Sprintf("/apps/%v/addons/%v", appIdentity, addOnIdentity))
417 }
418
419 // Info for an existing add-on.
420 func (s *Service) AddOnInfoByApp(ctx context.Context, appIdentity string, addOnIdentity string) (*AddOn, error) {
421 var addOn AddOn
422 return &addOn, s.Get(ctx, &addOn, fmt.Sprintf("/apps/%v/addons/%v", appIdentity, addOnIdentity), nil, nil)
423 }
424
425 type AddOnListByAppResult []AddOn
426
427 // List existing add-ons for an app.
428 func (s *Service) AddOnListByApp(ctx context.Context, appIdentity string, lr *ListRange) (AddOnListByAppResult, error) {
429 var addOn AddOnListByAppResult
430 return addOn, s.Get(ctx, &addOn, fmt.Sprintf("/apps/%v/addons", appIdentity), nil, lr)
431 }
432
433 type AddOnUpdateOpts struct {
434 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // globally unique name of the add-on
435 Plan string `json:"plan" url:"plan,key"` // unique identifier of this plan
436 }
437
438 // Change add-on plan. Some add-ons may not support changing plans. In
439 // that case, an error will be returned.
440 func (s *Service) AddOnUpdate(ctx context.Context, appIdentity string, addOnIdentity string, o AddOnUpdateOpts) (*AddOn, error) {
441 var addOn AddOn
442 return &addOn, s.Patch(ctx, &addOn, fmt.Sprintf("/apps/%v/addons/%v", appIdentity, addOnIdentity), o)
443 }
444
445 type AddOnListByUserResult []AddOn
446
447 // List all existing add-ons a user has access to
448 func (s *Service) AddOnListByUser(ctx context.Context, accountIdentity string, lr *ListRange) (AddOnListByUserResult, error) {
449 var addOn AddOnListByUserResult
450 return addOn, s.Get(ctx, &addOn, fmt.Sprintf("/users/%v/addons", accountIdentity), nil, lr)
451 }
452
453 type AddOnListByTeamResult []AddOn
454
455 // List add-ons used across all Team apps
456 func (s *Service) AddOnListByTeam(ctx context.Context, teamIdentity string, lr *ListRange) (AddOnListByTeamResult, error) {
457 var addOn AddOnListByTeamResult
458 return addOn, s.Get(ctx, &addOn, fmt.Sprintf("/teams/%v/addons", teamIdentity), nil, lr)
459 }
460
461 type AddOnResolutionOpts struct {
462 Addon string `json:"addon" url:"addon,key"` // globally unique name of the add-on
463 AddonService *string `json:"addon_service,omitempty" url:"addon_service,omitempty,key"` // unique name of this add-on-service
464 App *string `json:"app,omitempty" url:"app,omitempty,key"` // unique name of app
465 }
466 type AddOnResolutionResult []AddOn
467
468 // Resolve an add-on from a name, optionally passing an app name. If
469 // there are matches it returns at least one add-on (exact match) or
470 // many.
471 func (s *Service) AddOnResolution(ctx context.Context, o AddOnResolutionOpts) (AddOnResolutionResult, error) {
472 var addOn AddOnResolutionResult
473 return addOn, s.Post(ctx, &addOn, fmt.Sprintf("/actions/addons/resolve"), o)
474 }
475
476 // Add-on Actions are lifecycle operations for add-on provisioning and
477 // deprovisioning. They allow add-on providers to (de)provision add-ons
478 // in the background and then report back when (de)provisioning is
479 // complete.
480 type AddOnAction struct{}
481 type AddOnActionProvisionResult struct {
482 Actions []struct{} `json:"actions" url:"actions,key"` // provider actions for this specific add-on
483 AddonService struct {
484 ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
485 Name string `json:"name" url:"name,key"` // unique name of this add-on-service
486 } `json:"addon_service" url:"addon_service,key"` // identity of add-on service
487 App struct {
488 ID string `json:"id" url:"id,key"` // unique identifier of app
489 Name string `json:"name" url:"name,key"` // unique name of app
490 } `json:"app" url:"app,key"` // billing application associated with this add-on
491 BilledPrice *struct {
492 Cents int `json:"cents" url:"cents,key"` // price in cents per unit of plan
493 Contract bool `json:"contract" url:"contract,key"` // price is negotiated in a contract outside of monthly add-on billing
494 Unit string `json:"unit" url:"unit,key"` // unit of price for plan
495 } `json:"billed_price" url:"billed_price,key"` // billed price
496 BillingEntity struct {
497 ID string `json:"id" url:"id,key"` // unique identifier of the billing entity
498 Name string `json:"name" url:"name,key"` // name of the billing entity
499 Type string `json:"type" url:"type,key"` // type of Object of the billing entity; new types allowed at any time.
500 } `json:"billing_entity" url:"billing_entity,key"` // billing entity associated with this add-on
501 ConfigVars []string `json:"config_vars" url:"config_vars,key"` // config vars exposed to the owning app by this add-on
502 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on was created
503 ID string `json:"id" url:"id,key"` // unique identifier of add-on
504 Name string `json:"name" url:"name,key"` // globally unique name of the add-on
505 Plan struct {
506 ID string `json:"id" url:"id,key"` // unique identifier of this plan
507 Name string `json:"name" url:"name,key"` // unique name of this plan
508 } `json:"plan" url:"plan,key"` // identity of add-on plan
509 ProviderID string `json:"provider_id" url:"provider_id,key"` // id of this add-on with its provider
510 State string `json:"state" url:"state,key"` // state in the add-on's lifecycle
511 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on was updated
512 WebURL *string `json:"web_url" url:"web_url,key"` // URL for logging into web interface of add-on (e.g. a dashboard)
513 }
514
515 // Mark an add-on as provisioned for use.
516 func (s *Service) AddOnActionProvision(ctx context.Context, addOnIdentity string) (*AddOnActionProvisionResult, error) {
517 var addOnAction AddOnActionProvisionResult
518 return &addOnAction, s.Post(ctx, &addOnAction, fmt.Sprintf("/addons/%v/actions/provision", addOnIdentity), nil)
519 }
520
521 type AddOnActionDeprovisionResult struct {
522 Actions []struct{} `json:"actions" url:"actions,key"` // provider actions for this specific add-on
523 AddonService struct {
524 ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
525 Name string `json:"name" url:"name,key"` // unique name of this add-on-service
526 } `json:"addon_service" url:"addon_service,key"` // identity of add-on service
527 App struct {
528 ID string `json:"id" url:"id,key"` // unique identifier of app
529 Name string `json:"name" url:"name,key"` // unique name of app
530 } `json:"app" url:"app,key"` // billing application associated with this add-on
531 BilledPrice *struct {
532 Cents int `json:"cents" url:"cents,key"` // price in cents per unit of plan
533 Contract bool `json:"contract" url:"contract,key"` // price is negotiated in a contract outside of monthly add-on billing
534 Unit string `json:"unit" url:"unit,key"` // unit of price for plan
535 } `json:"billed_price" url:"billed_price,key"` // billed price
536 BillingEntity struct {
537 ID string `json:"id" url:"id,key"` // unique identifier of the billing entity
538 Name string `json:"name" url:"name,key"` // name of the billing entity
539 Type string `json:"type" url:"type,key"` // type of Object of the billing entity; new types allowed at any time.
540 } `json:"billing_entity" url:"billing_entity,key"` // billing entity associated with this add-on
541 ConfigVars []string `json:"config_vars" url:"config_vars,key"` // config vars exposed to the owning app by this add-on
542 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on was created
543 ID string `json:"id" url:"id,key"` // unique identifier of add-on
544 Name string `json:"name" url:"name,key"` // globally unique name of the add-on
545 Plan struct {
546 ID string `json:"id" url:"id,key"` // unique identifier of this plan
547 Name string `json:"name" url:"name,key"` // unique name of this plan
548 } `json:"plan" url:"plan,key"` // identity of add-on plan
549 ProviderID string `json:"provider_id" url:"provider_id,key"` // id of this add-on with its provider
550 State string `json:"state" url:"state,key"` // state in the add-on's lifecycle
551 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on was updated
552 WebURL *string `json:"web_url" url:"web_url,key"` // URL for logging into web interface of add-on (e.g. a dashboard)
553 }
554
555 // Mark an add-on as deprovisioned.
556 func (s *Service) AddOnActionDeprovision(ctx context.Context, addOnIdentity string) (*AddOnActionDeprovisionResult, error) {
557 var addOnAction AddOnActionDeprovisionResult
558 return &addOnAction, s.Post(ctx, &addOnAction, fmt.Sprintf("/addons/%v/actions/deprovision", addOnIdentity), nil)
559 }
560
561 // An add-on attachment represents a connection between an app and an
562 // add-on that it has been given access to.
563 type AddOnAttachment struct {
564 Addon struct {
565 App struct {
566 ID string `json:"id" url:"id,key"` // unique identifier of app
567 Name string `json:"name" url:"name,key"` // unique name of app
568 } `json:"app" url:"app,key"` // billing application associated with this add-on
569 ID string `json:"id" url:"id,key"` // unique identifier of add-on
570 Name string `json:"name" url:"name,key"` // globally unique name of the add-on
571 } `json:"addon" url:"addon,key"` // identity of add-on
572 App struct {
573 ID string `json:"id" url:"id,key"` // unique identifier of app
574 Name string `json:"name" url:"name,key"` // unique name of app
575 } `json:"app" url:"app,key"` // application that is attached to add-on
576 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on attachment was created
577 ID string `json:"id" url:"id,key"` // unique identifier of this add-on attachment
578 LogInputURL *string `json:"log_input_url" url:"log_input_url,key"` // URL for add-on partners to write to an add-on's logs
579 Name string `json:"name" url:"name,key"` // unique name for this add-on attachment to this app
580 Namespace *string `json:"namespace" url:"namespace,key"` // attachment namespace
581 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on attachment was updated
582 WebURL *string `json:"web_url" url:"web_url,key"` // URL for logging into web interface of add-on in attached app context
583 }
584 type AddOnAttachmentCreateOpts struct {
585 Addon string `json:"addon" url:"addon,key"` // unique identifier of add-on
586 App string `json:"app" url:"app,key"` // unique identifier of app
587 Confirm *string `json:"confirm,omitempty" url:"confirm,omitempty,key"` // name of owning app for confirmation
588 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name for this add-on attachment to this app
589 Namespace *string `json:"namespace,omitempty" url:"namespace,omitempty,key"` // attachment namespace
590 }
591
592 // Create a new add-on attachment.
593 func (s *Service) AddOnAttachmentCreate(ctx context.Context, o AddOnAttachmentCreateOpts) (*AddOnAttachment, error) {
594 var addOnAttachment AddOnAttachment
595 return &addOnAttachment, s.Post(ctx, &addOnAttachment, fmt.Sprintf("/addon-attachments"), o)
596 }
597
598 // Delete an existing add-on attachment.
599 func (s *Service) AddOnAttachmentDelete(ctx context.Context, addOnAttachmentIdentity string) (*AddOnAttachment, error) {
600 var addOnAttachment AddOnAttachment
601 return &addOnAttachment, s.Delete(ctx, &addOnAttachment, fmt.Sprintf("/addon-attachments/%v", addOnAttachmentIdentity))
602 }
603
604 // Info for existing add-on attachment.
605 func (s *Service) AddOnAttachmentInfo(ctx context.Context, addOnAttachmentIdentity string) (*AddOnAttachment, error) {
606 var addOnAttachment AddOnAttachment
607 return &addOnAttachment, s.Get(ctx, &addOnAttachment, fmt.Sprintf("/addon-attachments/%v", addOnAttachmentIdentity), nil, nil)
608 }
609
610 type AddOnAttachmentListResult []AddOnAttachment
611
612 // List existing add-on attachments.
613 func (s *Service) AddOnAttachmentList(ctx context.Context, lr *ListRange) (AddOnAttachmentListResult, error) {
614 var addOnAttachment AddOnAttachmentListResult
615 return addOnAttachment, s.Get(ctx, &addOnAttachment, fmt.Sprintf("/addon-attachments"), nil, lr)
616 }
617
618 type AddOnAttachmentListByAddOnResult []AddOnAttachment
619
620 // List existing add-on attachments for an add-on.
621 func (s *Service) AddOnAttachmentListByAddOn(ctx context.Context, addOnIdentity string, lr *ListRange) (AddOnAttachmentListByAddOnResult, error) {
622 var addOnAttachment AddOnAttachmentListByAddOnResult
623 return addOnAttachment, s.Get(ctx, &addOnAttachment, fmt.Sprintf("/addons/%v/addon-attachments", addOnIdentity), nil, lr)
624 }
625
626 type AddOnAttachmentListByAppResult []AddOnAttachment
627
628 // List existing add-on attachments for an app.
629 func (s *Service) AddOnAttachmentListByApp(ctx context.Context, appIdentity string, lr *ListRange) (AddOnAttachmentListByAppResult, error) {
630 var addOnAttachment AddOnAttachmentListByAppResult
631 return addOnAttachment, s.Get(ctx, &addOnAttachment, fmt.Sprintf("/apps/%v/addon-attachments", appIdentity), nil, lr)
632 }
633
634 // Info for existing add-on attachment for an app.
635 func (s *Service) AddOnAttachmentInfoByApp(ctx context.Context, appIdentity string, addOnAttachmentScopedIdentity string) (*AddOnAttachment, error) {
636 var addOnAttachment AddOnAttachment
637 return &addOnAttachment, s.Get(ctx, &addOnAttachment, fmt.Sprintf("/apps/%v/addon-attachments/%v", appIdentity, addOnAttachmentScopedIdentity), nil, nil)
638 }
639
640 type AddOnAttachmentResolutionOpts struct {
641 AddonAttachment string `json:"addon_attachment" url:"addon_attachment,key"` // unique name for this add-on attachment to this app
642 AddonService *string `json:"addon_service,omitempty" url:"addon_service,omitempty,key"` // unique name of this add-on-service
643 App *string `json:"app,omitempty" url:"app,omitempty,key"` // unique name of app
644 }
645 type AddOnAttachmentResolutionResult []AddOnAttachment
646
647 // Resolve an add-on attachment from a name, optionally passing an app
648 // name. If there are matches it returns at least one add-on attachment
649 // (exact match) or many.
650 func (s *Service) AddOnAttachmentResolution(ctx context.Context, o AddOnAttachmentResolutionOpts) (AddOnAttachmentResolutionResult, error) {
651 var addOnAttachment AddOnAttachmentResolutionResult
652 return addOnAttachment, s.Post(ctx, &addOnAttachment, fmt.Sprintf("/actions/addon-attachments/resolve"), o)
653 }
654
655 // Configuration of an Add-on
656 type AddOnConfig struct {
657 Name string `json:"name" url:"name,key"` // unique name of the config
658 Value *string `json:"value" url:"value,key"` // value of the config
659 }
660 type AddOnConfigListResult []AddOnConfig
661
662 // Get an add-on's config. Accessible by customers with access and by
663 // the add-on partner providing this add-on.
664 func (s *Service) AddOnConfigList(ctx context.Context, addOnIdentity string, lr *ListRange) (AddOnConfigListResult, error) {
665 var addOnConfig AddOnConfigListResult
666 return addOnConfig, s.Get(ctx, &addOnConfig, fmt.Sprintf("/addons/%v/config", addOnIdentity), nil, lr)
667 }
668
669 type AddOnConfigUpdateOpts struct {
670 Config []*struct {
671 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of the config
672 Value *string `json:"value,omitempty" url:"value,omitempty,key"` // value of the config
673 } `json:"config,omitempty" url:"config,omitempty,key"`
674 }
675 type AddOnConfigUpdateResult []AddOnConfig
676
677 // Update an add-on's config. Can only be accessed by the add-on partner
678 // providing this add-on.
679 func (s *Service) AddOnConfigUpdate(ctx context.Context, addOnIdentity string, o AddOnConfigUpdateOpts) (AddOnConfigUpdateResult, error) {
680 var addOnConfig AddOnConfigUpdateResult
681 return addOnConfig, s.Patch(ctx, &addOnConfig, fmt.Sprintf("/addons/%v/config", addOnIdentity), o)
682 }
683
684 // Add-on Plan Actions are Provider functionality for specific add-on
685 // installations
686 type AddOnPlanAction struct {
687 Action string `json:"action" url:"action,key"` // identifier of the action to take that is sent via SSO
688 ID string `json:"id" url:"id,key"` // a unique identifier
689 Label string `json:"label" url:"label,key"` // the display text shown in Dashboard
690 RequiresOwner bool `json:"requires_owner" url:"requires_owner,key"` // if the action requires the user to own the app
691 URL string `json:"url" url:"url,key"` // absolute URL to use instead of an action
692 }
693
694 // Add-on region capabilities represent the relationship between an
695 // Add-on Service and a specific Region. Only Beta and GA add-ons are
696 // returned by these endpoints.
697 type AddOnRegionCapability struct {
698 AddonService struct {
699 CliPluginName *string `json:"cli_plugin_name" url:"cli_plugin_name,key"` // npm package name of the add-on service's Heroku CLI plugin
700 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on-service was created
701 HumanName string `json:"human_name" url:"human_name,key"` // human-readable name of the add-on service provider
702 ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
703 Name string `json:"name" url:"name,key"` // unique name of this add-on-service
704 State string `json:"state" url:"state,key"` // release status for add-on service
705 SupportsMultipleInstallations bool `json:"supports_multiple_installations" url:"supports_multiple_installations,key"` // whether or not apps can have access to more than one instance of this
706 // add-on at the same time
707 SupportsSharing bool `json:"supports_sharing" url:"supports_sharing,key"` // whether or not apps can have access to add-ons billed to a different
708 // app
709 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on-service was updated
710 } `json:"addon_service" url:"addon_service,key"` // Add-on services represent add-ons that may be provisioned for apps.
711 // Endpoints under add-on services can be accessed without
712 // authentication.
713 ID string `json:"id" url:"id,key"` // unique identifier of this add-on-region-capability
714 Region struct {
715 Country string `json:"country" url:"country,key"` // country where the region exists
716 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when region was created
717 Description string `json:"description" url:"description,key"` // description of region
718 ID string `json:"id" url:"id,key"` // unique identifier of region
719 Locale string `json:"locale" url:"locale,key"` // area in the country where the region exists
720 Name string `json:"name" url:"name,key"` // unique name of region
721 PrivateCapable bool `json:"private_capable" url:"private_capable,key"` // whether or not region is available for creating a Private Space
722 Provider struct {
723 Name string `json:"name" url:"name,key"` // name of provider
724 Region string `json:"region" url:"region,key"` // region name used by provider
725 } `json:"provider" url:"provider,key"` // provider of underlying substrate
726 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when region was updated
727 } `json:"region" url:"region,key"` // A region represents a geographic location in which your application
728 // may run.
729 SupportsPrivateNetworking bool `json:"supports_private_networking" url:"supports_private_networking,key"` // whether the add-on can be installed to a Space
730 }
731 type AddOnRegionCapabilityListResult []AddOnRegionCapability
732
733 // List all existing add-on region capabilities.
734 func (s *Service) AddOnRegionCapabilityList(ctx context.Context, lr *ListRange) (AddOnRegionCapabilityListResult, error) {
735 var addOnRegionCapability AddOnRegionCapabilityListResult
736 return addOnRegionCapability, s.Get(ctx, &addOnRegionCapability, fmt.Sprintf("/addon-region-capabilities"), nil, lr)
737 }
738
739 type AddOnRegionCapabilityListByAddOnServiceResult []AddOnRegionCapability
740
741 // List existing add-on region capabilities for an add-on-service
742 func (s *Service) AddOnRegionCapabilityListByAddOnService(ctx context.Context, addOnServiceIdentity string, lr *ListRange) (AddOnRegionCapabilityListByAddOnServiceResult, error) {
743 var addOnRegionCapability AddOnRegionCapabilityListByAddOnServiceResult
744 return addOnRegionCapability, s.Get(ctx, &addOnRegionCapability, fmt.Sprintf("/addon-services/%v/region-capabilities", addOnServiceIdentity), nil, lr)
745 }
746
747 type AddOnRegionCapabilityListByRegionResult []AddOnRegionCapability
748
749 // List existing add-on region capabilities for a region.
750 func (s *Service) AddOnRegionCapabilityListByRegion(ctx context.Context, regionIdentity string, lr *ListRange) (AddOnRegionCapabilityListByRegionResult, error) {
751 var addOnRegionCapability AddOnRegionCapabilityListByRegionResult
752 return addOnRegionCapability, s.Get(ctx, &addOnRegionCapability, fmt.Sprintf("/regions/%v/addon-region-capabilities", regionIdentity), nil, lr)
753 }
754
755 // Add-on services represent add-ons that may be provisioned for apps.
756 // Endpoints under add-on services can be accessed without
757 // authentication.
758 type AddOnService struct {
759 CliPluginName *string `json:"cli_plugin_name" url:"cli_plugin_name,key"` // npm package name of the add-on service's Heroku CLI plugin
760 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on-service was created
761 HumanName string `json:"human_name" url:"human_name,key"` // human-readable name of the add-on service provider
762 ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
763 Name string `json:"name" url:"name,key"` // unique name of this add-on-service
764 State string `json:"state" url:"state,key"` // release status for add-on service
765 SupportsMultipleInstallations bool `json:"supports_multiple_installations" url:"supports_multiple_installations,key"` // whether or not apps can have access to more than one instance of this
766 // add-on at the same time
767 SupportsSharing bool `json:"supports_sharing" url:"supports_sharing,key"` // whether or not apps can have access to add-ons billed to a different
768 // app
769 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on-service was updated
770 }
771
772 // Info for existing add-on-service.
773 func (s *Service) AddOnServiceInfo(ctx context.Context, addOnServiceIdentity string) (*AddOnService, error) {
774 var addOnService AddOnService
775 return &addOnService, s.Get(ctx, &addOnService, fmt.Sprintf("/addon-services/%v", addOnServiceIdentity), nil, nil)
776 }
777
778 type AddOnServiceListResult []AddOnService
779
780 // List existing add-on-services.
781 func (s *Service) AddOnServiceList(ctx context.Context, lr *ListRange) (AddOnServiceListResult, error) {
782 var addOnService AddOnServiceListResult
783 return addOnService, s.Get(ctx, &addOnService, fmt.Sprintf("/addon-services"), nil, lr)
784 }
785
786 // Represents the details of a webhook subscription
787 type AddOnWebhook struct {
788 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
789 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
790 Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
791 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
792 // If `sync`, Heroku attempts multiple deliveries until the request is
793 // successful or a limit is reached
794 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
795 URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
796 }
797 type AddOnWebhookCreateOpts struct {
798 Authorization *string `json:"authorization,omitempty" url:"authorization,omitempty,key"` // a custom `Authorization` header that Heroku will include with all
799 // webhook notifications
800 Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
801 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
802 // If `sync`, Heroku attempts multiple deliveries until the request is
803 // successful or a limit is reached
804 Secret *string `json:"secret,omitempty" url:"secret,omitempty,key"` // a value that Heroku will use to sign all webhook notification
805 // requests (the signature is included in the request’s
806 // `Heroku-Webhook-Hmac-SHA256` header)
807 URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
808 }
809 type AddOnWebhookCreateResult struct {
810 Addon struct {
811 ID string `json:"id" url:"id,key"` // unique identifier of add-on
812 Name string `json:"name" url:"name,key"` // globally unique name of the add-on
813 } `json:"addon" url:"addon,key"` // identity of add-on. Only used for add-on partner webhooks.
814 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
815 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
816 Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
817 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
818 // If `sync`, Heroku attempts multiple deliveries until the request is
819 // successful or a limit is reached
820 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
821 URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
822 }
823
824 // Create an add-on webhook subscription. Can only be accessed by the
825 // add-on partner providing this add-on.
826 func (s *Service) AddOnWebhookCreate(ctx context.Context, addOnIdentity string, o AddOnWebhookCreateOpts) (*AddOnWebhookCreateResult, error) {
827 var addOnWebhook AddOnWebhookCreateResult
828 return &addOnWebhook, s.Post(ctx, &addOnWebhook, fmt.Sprintf("/addons/%v/webhooks", addOnIdentity), o)
829 }
830
831 type AddOnWebhookDeleteResult struct {
832 Addon struct {
833 ID string `json:"id" url:"id,key"` // unique identifier of add-on
834 Name string `json:"name" url:"name,key"` // globally unique name of the add-on
835 } `json:"addon" url:"addon,key"` // identity of add-on. Only used for add-on partner webhooks.
836 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
837 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
838 Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
839 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
840 // If `sync`, Heroku attempts multiple deliveries until the request is
841 // successful or a limit is reached
842 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
843 URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
844 }
845
846 // Removes an add-on webhook subscription. Can only be accessed by the
847 // add-on partner providing this add-on.
848 func (s *Service) AddOnWebhookDelete(ctx context.Context, addOnIdentity string, appWebhookIdentity string) (*AddOnWebhookDeleteResult, error) {
849 var addOnWebhook AddOnWebhookDeleteResult
850 return &addOnWebhook, s.Delete(ctx, &addOnWebhook, fmt.Sprintf("/addons/%v/webhooks/%v", addOnIdentity, appWebhookIdentity))
851 }
852
853 type AddOnWebhookInfoResult struct {
854 Addon struct {
855 ID string `json:"id" url:"id,key"` // unique identifier of add-on
856 Name string `json:"name" url:"name,key"` // globally unique name of the add-on
857 } `json:"addon" url:"addon,key"` // identity of add-on. Only used for add-on partner webhooks.
858 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
859 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
860 Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
861 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
862 // If `sync`, Heroku attempts multiple deliveries until the request is
863 // successful or a limit is reached
864 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
865 URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
866 }
867
868 // Returns the info for an add-on webhook subscription. Can only be
869 // accessed by the add-on partner providing this add-on.
870 func (s *Service) AddOnWebhookInfo(ctx context.Context, addOnIdentity string, appWebhookIdentity string) (*AddOnWebhookInfoResult, error) {
871 var addOnWebhook AddOnWebhookInfoResult
872 return &addOnWebhook, s.Get(ctx, &addOnWebhook, fmt.Sprintf("/addons/%v/webhooks/%v", addOnIdentity, appWebhookIdentity), nil, nil)
873 }
874
875 type AddOnWebhookListResult []struct {
876 Addon struct {
877 ID string `json:"id" url:"id,key"` // unique identifier of add-on
878 Name string `json:"name" url:"name,key"` // globally unique name of the add-on
879 } `json:"addon" url:"addon,key"` // identity of add-on. Only used for add-on partner webhooks.
880 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
881 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
882 Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
883 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
884 // If `sync`, Heroku attempts multiple deliveries until the request is
885 // successful or a limit is reached
886 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
887 URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
888 }
889
890 // List all webhook subscriptions for a particular add-on. Can only be
891 // accessed by the add-on partner providing this add-on.
892 func (s *Service) AddOnWebhookList(ctx context.Context, addOnIdentity string, lr *ListRange) (AddOnWebhookListResult, error) {
893 var addOnWebhook AddOnWebhookListResult
894 return addOnWebhook, s.Get(ctx, &addOnWebhook, fmt.Sprintf("/addons/%v/webhooks", addOnIdentity), nil, lr)
895 }
896
897 type AddOnWebhookUpdateOpts struct {
898 Authorization *string `json:"authorization,omitempty" url:"authorization,omitempty,key"` // a custom `Authorization` header that Heroku will include with all
899 // webhook notifications
900 Include []*string `json:"include,omitempty" url:"include,omitempty,key"` // the entities that the subscription provides notifications for
901 Level *string `json:"level,omitempty" url:"level,omitempty,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
902 // If `sync`, Heroku attempts multiple deliveries until the request is
903 // successful or a limit is reached
904 Secret *string `json:"secret,omitempty" url:"secret,omitempty,key"` // a value that Heroku will use to sign all webhook notification
905 // requests (the signature is included in the request’s
906 // `Heroku-Webhook-Hmac-SHA256` header)
907 URL *string `json:"url,omitempty" url:"url,omitempty,key"` // the URL where the webhook's notification requests are sent
908 }
909 type AddOnWebhookUpdateResult struct {
910 Addon struct {
911 ID string `json:"id" url:"id,key"` // unique identifier of add-on
912 Name string `json:"name" url:"name,key"` // globally unique name of the add-on
913 } `json:"addon" url:"addon,key"` // identity of add-on. Only used for add-on partner webhooks.
914 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
915 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
916 Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
917 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
918 // If `sync`, Heroku attempts multiple deliveries until the request is
919 // successful or a limit is reached
920 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
921 URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
922 }
923
924 // Updates the details of an add-on webhook subscription. Can only be
925 // accessed by the add-on partner providing this add-on.
926 func (s *Service) AddOnWebhookUpdate(ctx context.Context, addOnIdentity string, appWebhookIdentity string, o AddOnWebhookUpdateOpts) (*AddOnWebhookUpdateResult, error) {
927 var addOnWebhook AddOnWebhookUpdateResult
928 return &addOnWebhook, s.Patch(ctx, &addOnWebhook, fmt.Sprintf("/addons/%v/webhooks/%v", addOnIdentity, appWebhookIdentity), o)
929 }
930
931 // Represents the delivery of a webhook notification, including its
932 // current status.
933 type AddOnWebhookDelivery struct{}
934 type AddOnWebhookDeliveryInfoResult struct {
935 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the delivery was created
936 Event struct {
937 ID string `json:"id" url:"id,key"` // the event's unique identifier
938 Include string `json:"include" url:"include,key"` // the type of entity that the event is related to
939 } `json:"event" url:"event,key"` // identity of event
940 ID string `json:"id" url:"id,key"` // the delivery's unique identifier
941 LastAttempt *struct {
942 Code *int `json:"code" url:"code,key"` // http response code received during attempt
943 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when attempt was created
944 ErrorClass *string `json:"error_class" url:"error_class,key"` // error class encountered during attempt
945 ID string `json:"id" url:"id,key"` // unique identifier of attempt
946 Status string `json:"status" url:"status,key"` // status of an attempt
947 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when attempt was updated
948 } `json:"last_attempt" url:"last_attempt,key"` // last attempt of a delivery
949 NextAttemptAt *time.Time `json:"next_attempt_at" url:"next_attempt_at,key"` // when delivery will be attempted again
950 NumAttempts int `json:"num_attempts" url:"num_attempts,key"` // number of times a delivery has been attempted
951 Status string `json:"status" url:"status,key"` // the delivery's status
952 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the delivery was last updated
953 Webhook struct {
954 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
955 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
956 // If `sync`, Heroku attempts multiple deliveries until the request is
957 // successful or a limit is reached
958 } `json:"webhook" url:"webhook,key"` // identity of webhook
959 }
960
961 // Returns the info for an existing delivery. Can only be accessed by
962 // the add-on partner providing this add-on.
963 func (s *Service) AddOnWebhookDeliveryInfo(ctx context.Context, addOnIdentity string, appWebhookDeliveryIdentity string) (*AddOnWebhookDeliveryInfoResult, error) {
964 var addOnWebhookDelivery AddOnWebhookDeliveryInfoResult
965 return &addOnWebhookDelivery, s.Get(ctx, &addOnWebhookDelivery, fmt.Sprintf("/addons/%v/webhook-deliveries/%v", addOnIdentity, appWebhookDeliveryIdentity), nil, nil)
966 }
967
968 type AddOnWebhookDeliveryListResult []struct {
969 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the delivery was created
970 Event struct {
971 ID string `json:"id" url:"id,key"` // the event's unique identifier
972 Include string `json:"include" url:"include,key"` // the type of entity that the event is related to
973 } `json:"event" url:"event,key"` // identity of event
974 ID string `json:"id" url:"id,key"` // the delivery's unique identifier
975 LastAttempt *struct {
976 Code *int `json:"code" url:"code,key"` // http response code received during attempt
977 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when attempt was created
978 ErrorClass *string `json:"error_class" url:"error_class,key"` // error class encountered during attempt
979 ID string `json:"id" url:"id,key"` // unique identifier of attempt
980 Status string `json:"status" url:"status,key"` // status of an attempt
981 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when attempt was updated
982 } `json:"last_attempt" url:"last_attempt,key"` // last attempt of a delivery
983 NextAttemptAt *time.Time `json:"next_attempt_at" url:"next_attempt_at,key"` // when delivery will be attempted again
984 NumAttempts int `json:"num_attempts" url:"num_attempts,key"` // number of times a delivery has been attempted
985 Status string `json:"status" url:"status,key"` // the delivery's status
986 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the delivery was last updated
987 Webhook struct {
988 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
989 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
990 // If `sync`, Heroku attempts multiple deliveries until the request is
991 // successful or a limit is reached
992 } `json:"webhook" url:"webhook,key"` // identity of webhook
993 }
994
995 // Lists existing deliveries for an add-on. Can only be accessed by the
996 // add-on partner providing this add-on.
997 func (s *Service) AddOnWebhookDeliveryList(ctx context.Context, addOnIdentity string, lr *ListRange) (AddOnWebhookDeliveryListResult, error) {
998 var addOnWebhookDelivery AddOnWebhookDeliveryListResult
999 return addOnWebhookDelivery, s.Get(ctx, &addOnWebhookDelivery, fmt.Sprintf("/addons/%v/webhook-deliveries", addOnIdentity), nil, lr)
1000 }
1001
1002 // Represents a webhook event that occurred.
1003 type AddOnWebhookEvent struct{}
1004 type AddOnWebhookEventInfoResult struct {
1005 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when event was created
1006 ID string `json:"id" url:"id,key"` // the event's unique identifier
1007 Include string `json:"include" url:"include,key"` // the type of entity that the event is related to
1008 Payload struct {
1009 Action string `json:"action" url:"action,key"` // the type of event that occurred
1010 Actor struct {
1011 Email string `json:"email" url:"email,key"` // unique email address of account
1012 ID string `json:"id" url:"id,key"` // unique identifier of an account
1013 } `json:"actor" url:"actor,key"` // user that caused event
1014 Data struct{} `json:"data" url:"data,key"` // the current details of the event
1015 PreviousData struct{} `json:"previous_data" url:"previous_data,key"` // previous details of the event (if any)
1016 Resource string `json:"resource" url:"resource,key"` // the type of resource associated with the event
1017 Version string `json:"version" url:"version,key"` // the version of the details provided for the event
1018 } `json:"payload" url:"payload,key"` // payload of event
1019 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the event was last updated
1020 }
1021
1022 // Returns the info for a specified webhook event. Can only be accessed
1023 // by the add-on partner providing this add-on.
1024 func (s *Service) AddOnWebhookEventInfo(ctx context.Context, addOnIdentity string, appWebhookEventIdentity string) (*AddOnWebhookEventInfoResult, error) {
1025 var addOnWebhookEvent AddOnWebhookEventInfoResult
1026 return &addOnWebhookEvent, s.Get(ctx, &addOnWebhookEvent, fmt.Sprintf("/addons/%v/webhook-events/%v", addOnIdentity, appWebhookEventIdentity), nil, nil)
1027 }
1028
1029 type AddOnWebhookEventListResult []struct {
1030 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when event was created
1031 ID string `json:"id" url:"id,key"` // the event's unique identifier
1032 Include string `json:"include" url:"include,key"` // the type of entity that the event is related to
1033 Payload struct {
1034 Action string `json:"action" url:"action,key"` // the type of event that occurred
1035 Actor struct {
1036 Email string `json:"email" url:"email,key"` // unique email address of account
1037 ID string `json:"id" url:"id,key"` // unique identifier of an account
1038 } `json:"actor" url:"actor,key"` // user that caused event
1039 Data struct{} `json:"data" url:"data,key"` // the current details of the event
1040 PreviousData struct{} `json:"previous_data" url:"previous_data,key"` // previous details of the event (if any)
1041 Resource string `json:"resource" url:"resource,key"` // the type of resource associated with the event
1042 Version string `json:"version" url:"version,key"` // the version of the details provided for the event
1043 } `json:"payload" url:"payload,key"` // payload of event
1044 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the event was last updated
1045 }
1046
1047 // Lists existing webhook events for an add-on. Can only be accessed by
1048 // the add-on partner providing this add-on.
1049 func (s *Service) AddOnWebhookEventList(ctx context.Context, addOnIdentity string, lr *ListRange) (AddOnWebhookEventListResult, error) {
1050 var addOnWebhookEvent AddOnWebhookEventListResult
1051 return addOnWebhookEvent, s.Get(ctx, &addOnWebhookEvent, fmt.Sprintf("/addons/%v/webhook-events", addOnIdentity), nil, lr)
1052 }
1053
1054 // Entities that have been allowed to be used by a Team
1055 type AllowedAddOnService struct {
1056 AddedAt time.Time `json:"added_at" url:"added_at,key"` // when the add-on service was allowed
1057 AddedBy struct {
1058 Email string `json:"email" url:"email,key"` // unique email address of account
1059 ID string `json:"id" url:"id,key"` // unique identifier of an account
1060 } `json:"added_by" url:"added_by,key"` // the user which allowed the add-on service
1061 AddonService struct {
1062 HumanName string `json:"human_name" url:"human_name,key"` // human-readable name of the add-on service provider
1063 ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
1064 Name string `json:"name" url:"name,key"` // unique name of this add-on-service
1065 } `json:"addon_service" url:"addon_service,key"` // the add-on service allowed for use
1066 ID string `json:"id" url:"id,key"` // unique identifier for this allowed add-on service record
1067 }
1068 type AllowedAddOnServiceListByTeamResult []AllowedAddOnService
1069
1070 // List all allowed add-on services for a team
1071 func (s *Service) AllowedAddOnServiceListByTeam(ctx context.Context, teamIdentity string, lr *ListRange) (AllowedAddOnServiceListByTeamResult, error) {
1072 var allowedAddOnService AllowedAddOnServiceListByTeamResult
1073 return allowedAddOnService, s.Get(ctx, &allowedAddOnService, fmt.Sprintf("/teams/%v/allowed-addon-services", teamIdentity), nil, lr)
1074 }
1075
1076 type AllowedAddOnServiceCreateByTeamOpts struct {
1077 AddonService *string `json:"addon_service,omitempty" url:"addon_service,omitempty,key"` // name of the add-on service to allow
1078 }
1079 type AllowedAddOnServiceCreateByTeamResult []AllowedAddOnService
1080
1081 // Allow an Add-on Service
1082 func (s *Service) AllowedAddOnServiceCreateByTeam(ctx context.Context, teamIdentity string, o AllowedAddOnServiceCreateByTeamOpts) (AllowedAddOnServiceCreateByTeamResult, error) {
1083 var allowedAddOnService AllowedAddOnServiceCreateByTeamResult
1084 return allowedAddOnService, s.Post(ctx, &allowedAddOnService, fmt.Sprintf("/teams/%v/allowed-addon-services", teamIdentity), o)
1085 }
1086
1087 // Remove an allowed add-on service
1088 func (s *Service) AllowedAddOnServiceDeleteByTeam(ctx context.Context, teamIdentity string, allowedAddOnServiceIdentity string) (*AllowedAddOnService, error) {
1089 var allowedAddOnService AllowedAddOnService
1090 return &allowedAddOnService, s.Delete(ctx, &allowedAddOnService, fmt.Sprintf("/teams/%v/allowed-addon-services/%v", teamIdentity, allowedAddOnServiceIdentity))
1091 }
1092
1093 // An app represents the program that you would like to deploy and run
1094 // on Heroku.
1095 type App struct {
1096 Acm bool `json:"acm" url:"acm,key"` // ACM status of this app
1097 ArchivedAt *time.Time `json:"archived_at" url:"archived_at,key"` // when app was archived
1098 BuildStack struct {
1099 ID string `json:"id" url:"id,key"` // unique identifier of stack
1100 Name string `json:"name" url:"name,key"` // unique name of stack
1101 } `json:"build_stack" url:"build_stack,key"` // identity of the stack that will be used for new builds
1102 BuildpackProvidedDescription *string `json:"buildpack_provided_description" url:"buildpack_provided_description,key"` // description from buildpack of app
1103 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app was created
1104 GitURL string `json:"git_url" url:"git_url,key"` // git repo URL of app
1105 ID string `json:"id" url:"id,key"` // unique identifier of app
1106 InternalRouting *bool `json:"internal_routing" url:"internal_routing,key"` // describes whether a Private Spaces app is externally routable or not
1107 Maintenance bool `json:"maintenance" url:"maintenance,key"` // maintenance status of app
1108 Name string `json:"name" url:"name,key"` // unique name of app
1109 Organization *struct {
1110 ID string `json:"id" url:"id,key"` // unique identifier of team
1111 Name string `json:"name" url:"name,key"` // unique name of team
1112 } `json:"organization" url:"organization,key"` // identity of team
1113 Owner struct {
1114 Email string `json:"email" url:"email,key"` // unique email address of account
1115 ID string `json:"id" url:"id,key"` // unique identifier of an account
1116 } `json:"owner" url:"owner,key"` // identity of app owner
1117 Region struct {
1118 ID string `json:"id" url:"id,key"` // unique identifier of region
1119 Name string `json:"name" url:"name,key"` // unique name of region
1120 } `json:"region" url:"region,key"` // identity of app region
1121 ReleasedAt *time.Time `json:"released_at" url:"released_at,key"` // when app was released
1122 RepoSize *int `json:"repo_size" url:"repo_size,key"` // git repo size in bytes of app
1123 SlugSize *int `json:"slug_size" url:"slug_size,key"` // slug size in bytes of app
1124 Space *struct {
1125 ID string `json:"id" url:"id,key"` // unique identifier of space
1126 Name string `json:"name" url:"name,key"` // unique name of space
1127 Shield bool `json:"shield" url:"shield,key"` // true if this space has shield enabled
1128 } `json:"space" url:"space,key"` // identity of space
1129 Stack struct {
1130 ID string `json:"id" url:"id,key"` // unique identifier of stack
1131 Name string `json:"name" url:"name,key"` // unique name of stack
1132 } `json:"stack" url:"stack,key"` // identity of app stack
1133 Team *struct {
1134 ID string `json:"id" url:"id,key"` // unique identifier of team
1135 Name string `json:"name" url:"name,key"` // unique name of team
1136 } `json:"team" url:"team,key"` // identity of team
1137 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app was updated
1138 WebURL string `json:"web_url" url:"web_url,key"` // web URL of app
1139 }
1140 type AppCreateOpts struct {
1141 FeatureFlags []*string `json:"feature_flags,omitempty" url:"feature_flags,omitempty,key"` // unique name of app feature
1142 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of app
1143 Region *string `json:"region,omitempty" url:"region,omitempty,key"` // unique identifier of region
1144 Stack *string `json:"stack,omitempty" url:"stack,omitempty,key"` // unique name of stack
1145 }
1146
1147 // Create a new app.
1148 func (s *Service) AppCreate(ctx context.Context, o AppCreateOpts) (*App, error) {
1149 var app App
1150 return &app, s.Post(ctx, &app, fmt.Sprintf("/apps"), o)
1151 }
1152
1153 // Delete an existing app.
1154 func (s *Service) AppDelete(ctx context.Context, appIdentity string) (*App, error) {
1155 var app App
1156 return &app, s.Delete(ctx, &app, fmt.Sprintf("/apps/%v", appIdentity))
1157 }
1158
1159 // Info for existing app.
1160 func (s *Service) AppInfo(ctx context.Context, appIdentity string) (*App, error) {
1161 var app App
1162 return &app, s.Get(ctx, &app, fmt.Sprintf("/apps/%v", appIdentity), nil, nil)
1163 }
1164
1165 type AppListResult []App
1166
1167 // List existing apps.
1168 func (s *Service) AppList(ctx context.Context, lr *ListRange) (AppListResult, error) {
1169 var app AppListResult
1170 return app, s.Get(ctx, &app, fmt.Sprintf("/apps"), nil, lr)
1171 }
1172
1173 type AppListOwnedAndCollaboratedResult []App
1174
1175 // List owned and collaborated apps (excludes team apps).
1176 func (s *Service) AppListOwnedAndCollaborated(ctx context.Context, accountIdentity string, lr *ListRange) (AppListOwnedAndCollaboratedResult, error) {
1177 var app AppListOwnedAndCollaboratedResult
1178 return app, s.Get(ctx, &app, fmt.Sprintf("/users/%v/apps", accountIdentity), nil, lr)
1179 }
1180
1181 type AppUpdateOpts struct {
1182 BuildStack *string `json:"build_stack,omitempty" url:"build_stack,omitempty,key"` // unique name of stack
1183 Maintenance *bool `json:"maintenance,omitempty" url:"maintenance,omitempty,key"` // maintenance status of app
1184 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of app
1185 }
1186
1187 // Update an existing app.
1188 func (s *Service) AppUpdate(ctx context.Context, appIdentity string, o AppUpdateOpts) (*App, error) {
1189 var app App
1190 return &app, s.Patch(ctx, &app, fmt.Sprintf("/apps/%v", appIdentity), o)
1191 }
1192
1193 // Enable ACM flag for an app
1194 func (s *Service) AppEnableACM(ctx context.Context, appIdentity string) (*App, error) {
1195 var app App
1196 return &app, s.Post(ctx, &app, fmt.Sprintf("/apps/%v/acm", appIdentity), nil)
1197 }
1198
1199 // Disable ACM flag for an app
1200 func (s *Service) AppDisableACM(ctx context.Context, appIdentity string) (*App, error) {
1201 var app App
1202 return &app, s.Delete(ctx, &app, fmt.Sprintf("/apps/%v/acm", appIdentity))
1203 }
1204
1205 // Refresh ACM for an app
1206 func (s *Service) AppRefreshACM(ctx context.Context, appIdentity string) (*App, error) {
1207 var app App
1208 return &app, s.Patch(ctx, &app, fmt.Sprintf("/apps/%v/acm", appIdentity), nil)
1209 }
1210
1211 // An app feature represents a Heroku labs capability that can be
1212 // enabled or disabled for an app on Heroku.
1213 type AppFeature struct {
1214 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app feature was created
1215 Description string `json:"description" url:"description,key"` // description of app feature
1216 DisplayName string `json:"display_name" url:"display_name,key"` // user readable feature name
1217 DocURL string `json:"doc_url" url:"doc_url,key"` // documentation URL of app feature
1218 Enabled bool `json:"enabled" url:"enabled,key"` // whether or not app feature has been enabled
1219 FeedbackEmail string `json:"feedback_email" url:"feedback_email,key"` // e-mail to send feedback about the feature
1220 ID string `json:"id" url:"id,key"` // unique identifier of app feature
1221 Name string `json:"name" url:"name,key"` // unique name of app feature
1222 State string `json:"state" url:"state,key"` // state of app feature
1223 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app feature was updated
1224 }
1225
1226 // Info for an existing app feature.
1227 func (s *Service) AppFeatureInfo(ctx context.Context, appIdentity string, appFeatureIdentity string) (*AppFeature, error) {
1228 var appFeature AppFeature
1229 return &appFeature, s.Get(ctx, &appFeature, fmt.Sprintf("/apps/%v/features/%v", appIdentity, appFeatureIdentity), nil, nil)
1230 }
1231
1232 type AppFeatureListResult []AppFeature
1233
1234 // List existing app features.
1235 func (s *Service) AppFeatureList(ctx context.Context, appIdentity string, lr *ListRange) (AppFeatureListResult, error) {
1236 var appFeature AppFeatureListResult
1237 return appFeature, s.Get(ctx, &appFeature, fmt.Sprintf("/apps/%v/features", appIdentity), nil, lr)
1238 }
1239
1240 type AppFeatureUpdateOpts struct {
1241 Enabled bool `json:"enabled" url:"enabled,key"` // whether or not app feature has been enabled
1242 }
1243
1244 // Update an existing app feature.
1245 func (s *Service) AppFeatureUpdate(ctx context.Context, appIdentity string, appFeatureIdentity string, o AppFeatureUpdateOpts) (*AppFeature, error) {
1246 var appFeature AppFeature
1247 return &appFeature, s.Patch(ctx, &appFeature, fmt.Sprintf("/apps/%v/features/%v", appIdentity, appFeatureIdentity), o)
1248 }
1249
1250 // App formation set describes the combination of process types with
1251 // their quantities and sizes as well as application process tier
1252 type AppFormationSet struct {
1253 App struct {
1254 ID string `json:"id" url:"id,key"` // unique identifier of app
1255 Name string `json:"name" url:"name,key"` // unique name of app
1256 } `json:"app" url:"app,key"` // app being described by the formation-set
1257 Description string `json:"description" url:"description,key"` // a string representation of the formation set
1258 ProcessTier string `json:"process_tier" url:"process_tier,key"` // application process tier
1259 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // last time fomation-set was updated
1260 }
1261
1262 // An app setup represents an app on Heroku that is setup using an
1263 // environment, addons, and scripts described in an app.json manifest
1264 // file.
1265 type AppSetup struct {
1266 App struct {
1267 ID string `json:"id" url:"id,key"` // unique identifier of app
1268 Name string `json:"name" url:"name,key"` // unique name of app
1269 } `json:"app" url:"app,key"` // identity of app
1270 Build *struct {
1271 ID string `json:"id" url:"id,key"` // unique identifier of build
1272 OutputStreamURL string `json:"output_stream_url" url:"output_stream_url,key"` // Build process output will be available from this URL as a stream. The
1273 // stream is available as either `text/plain` or `text/event-stream`.
1274 // Clients should be prepared to handle disconnects and can resume the
1275 // stream by sending a `Range` header (for `text/plain`) or a
1276 // `Last-Event-Id` header (for `text/event-stream`).
1277 Status string `json:"status" url:"status,key"` // status of build
1278 } `json:"build" url:"build,key"` // identity and status of build
1279 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app setup was created
1280 FailureMessage *string `json:"failure_message" url:"failure_message,key"` // reason that app setup has failed
1281 ID string `json:"id" url:"id,key"` // unique identifier of app setup
1282 ManifestErrors []string `json:"manifest_errors" url:"manifest_errors,key"` // errors associated with invalid app.json manifest file
1283 Postdeploy *struct {
1284 ExitCode int `json:"exit_code" url:"exit_code,key"` // The exit code of the postdeploy script
1285 Output string `json:"output" url:"output,key"` // output of the postdeploy script
1286 } `json:"postdeploy" url:"postdeploy,key"` // result of postdeploy script
1287 ResolvedSuccessURL *string `json:"resolved_success_url" url:"resolved_success_url,key"` // fully qualified success url
1288 Status string `json:"status" url:"status,key"` // the overall status of app setup
1289 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app setup was updated
1290 }
1291 type AppSetupCreateOpts struct {
1292 App *struct {
1293 Locked *bool `json:"locked,omitempty" url:"locked,omitempty,key"` // are other team members forbidden from joining this app.
1294 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of app
1295 Organization *string `json:"organization,omitempty" url:"organization,omitempty,key"` // unique name of team
1296 Personal *bool `json:"personal,omitempty" url:"personal,omitempty,key"` // force creation of the app in the user account even if a default team
1297 // is set.
1298 Region *string `json:"region,omitempty" url:"region,omitempty,key"` // unique name of region
1299 Space *string `json:"space,omitempty" url:"space,omitempty,key"` // unique name of space
1300 Stack *string `json:"stack,omitempty" url:"stack,omitempty,key"` // unique name of stack
1301 } `json:"app,omitempty" url:"app,omitempty,key"` // optional parameters for created app
1302 Overrides *struct {
1303 Buildpacks []*struct {
1304 URL *string `json:"url,omitempty" url:"url,omitempty,key"` // location of the buildpack
1305 } `json:"buildpacks,omitempty" url:"buildpacks,omitempty,key"` // overrides the buildpacks specified in the app.json manifest file
1306 Env map[string]string `json:"env,omitempty" url:"env,omitempty,key"` // overrides of the env specified in the app.json manifest file
1307 } `json:"overrides,omitempty" url:"overrides,omitempty,key"` // overrides of keys in the app.json manifest file
1308 SourceBlob struct {
1309 Checksum *string `json:"checksum,omitempty" url:"checksum,omitempty,key"` // an optional checksum of the gzipped tarball for verifying its
1310 // integrity
1311 URL *string `json:"url,omitempty" url:"url,omitempty,key"` // URL of gzipped tarball of source code containing app.json manifest
1312 // file
1313 Version *string `json:"version,omitempty" url:"version,omitempty,key"` // Version of the gzipped tarball.
1314 } `json:"source_blob" url:"source_blob,key"` // gzipped tarball of source code containing app.json manifest file
1315 }
1316
1317 // Create a new app setup from a gzipped tar archive containing an
1318 // app.json manifest file.
1319 func (s *Service) AppSetupCreate(ctx context.Context, o AppSetupCreateOpts) (*AppSetup, error) {
1320 var appSetup AppSetup
1321 return &appSetup, s.Post(ctx, &appSetup, fmt.Sprintf("/app-setups"), o)
1322 }
1323
1324 // Get the status of an app setup.
1325 func (s *Service) AppSetupInfo(ctx context.Context, appSetupIdentity string) (*AppSetup, error) {
1326 var appSetup AppSetup
1327 return &appSetup, s.Get(ctx, &appSetup, fmt.Sprintf("/app-setups/%v", appSetupIdentity), nil, nil)
1328 }
1329
1330 // An app transfer represents a two party interaction for transferring
1331 // ownership of an app.
1332 type AppTransfer struct {
1333 App struct {
1334 ID string `json:"id" url:"id,key"` // unique identifier of app
1335 Name string `json:"name" url:"name,key"` // unique name of app
1336 } `json:"app" url:"app,key"` // app involved in the transfer
1337 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app transfer was created
1338 ID string `json:"id" url:"id,key"` // unique identifier of app transfer
1339 Owner struct {
1340 Email string `json:"email" url:"email,key"` // unique email address of account
1341 ID string `json:"id" url:"id,key"` // unique identifier of an account
1342 } `json:"owner" url:"owner,key"` // identity of the owner of the transfer
1343 Recipient struct {
1344 Email string `json:"email" url:"email,key"` // unique email address of account
1345 ID string `json:"id" url:"id,key"` // unique identifier of an account
1346 } `json:"recipient" url:"recipient,key"` // identity of the recipient of the transfer
1347 State string `json:"state" url:"state,key"` // the current state of an app transfer
1348 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app transfer was updated
1349 }
1350 type AppTransferCreateOpts struct {
1351 App string `json:"app" url:"app,key"` // unique identifier of app
1352 Recipient string `json:"recipient" url:"recipient,key"` // unique email address of account
1353 Silent *bool `json:"silent,omitempty" url:"silent,omitempty,key"` // whether to suppress email notification when transferring apps
1354 }
1355
1356 // Create a new app transfer.
1357 func (s *Service) AppTransferCreate(ctx context.Context, o AppTransferCreateOpts) (*AppTransfer, error) {
1358 var appTransfer AppTransfer
1359 return &appTransfer, s.Post(ctx, &appTransfer, fmt.Sprintf("/account/app-transfers"), o)
1360 }
1361
1362 // Delete an existing app transfer
1363 func (s *Service) AppTransferDelete(ctx context.Context, appTransferIdentity string) (*AppTransfer, error) {
1364 var appTransfer AppTransfer
1365 return &appTransfer, s.Delete(ctx, &appTransfer, fmt.Sprintf("/account/app-transfers/%v", appTransferIdentity))
1366 }
1367
1368 // Info for existing app transfer.
1369 func (s *Service) AppTransferInfo(ctx context.Context, appTransferIdentity string) (*AppTransfer, error) {
1370 var appTransfer AppTransfer
1371 return &appTransfer, s.Get(ctx, &appTransfer, fmt.Sprintf("/account/app-transfers/%v", appTransferIdentity), nil, nil)
1372 }
1373
1374 type AppTransferListResult []AppTransfer
1375
1376 // List existing apps transfers.
1377 func (s *Service) AppTransferList(ctx context.Context, lr *ListRange) (AppTransferListResult, error) {
1378 var appTransfer AppTransferListResult
1379 return appTransfer, s.Get(ctx, &appTransfer, fmt.Sprintf("/account/app-transfers"), nil, lr)
1380 }
1381
1382 type AppTransferUpdateOpts struct {
1383 State string `json:"state" url:"state,key"` // the current state of an app transfer
1384 }
1385
1386 // Update an existing app transfer.
1387 func (s *Service) AppTransferUpdate(ctx context.Context, appTransferIdentity string, o AppTransferUpdateOpts) (*AppTransfer, error) {
1388 var appTransfer AppTransfer
1389 return &appTransfer, s.Patch(ctx, &appTransfer, fmt.Sprintf("/account/app-transfers/%v", appTransferIdentity), o)
1390 }
1391
1392 // Represents the details of a webhook subscription
1393 type AppWebhook struct{}
1394 type AppWebhookCreateOpts struct {
1395 Authorization *string `json:"authorization,omitempty" url:"authorization,omitempty,key"` // a custom `Authorization` header that Heroku will include with all
1396 // webhook notifications
1397 Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
1398 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
1399 // If `sync`, Heroku attempts multiple deliveries until the request is
1400 // successful or a limit is reached
1401 Secret *string `json:"secret,omitempty" url:"secret,omitempty,key"` // a value that Heroku will use to sign all webhook notification
1402 // requests (the signature is included in the request’s
1403 // `Heroku-Webhook-Hmac-SHA256` header)
1404 URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
1405 }
1406 type AppWebhookCreateResult struct {
1407 App struct {
1408 ID string `json:"id" url:"id,key"` // unique identifier of app
1409 Name string `json:"name" url:"name,key"` // unique name of app
1410 } `json:"app" url:"app,key"` // identity of app. Only used for customer webhooks.
1411 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
1412 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
1413 Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
1414 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
1415 // If `sync`, Heroku attempts multiple deliveries until the request is
1416 // successful or a limit is reached
1417 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
1418 URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
1419 }
1420
1421 // Create an app webhook subscription.
1422 func (s *Service) AppWebhookCreate(ctx context.Context, appIdentity string, o AppWebhookCreateOpts) (*AppWebhookCreateResult, error) {
1423 var appWebhook AppWebhookCreateResult
1424 return &appWebhook, s.Post(ctx, &appWebhook, fmt.Sprintf("/apps/%v/webhooks", appIdentity), o)
1425 }
1426
1427 type AppWebhookDeleteResult struct {
1428 App struct {
1429 ID string `json:"id" url:"id,key"` // unique identifier of app
1430 Name string `json:"name" url:"name,key"` // unique name of app
1431 } `json:"app" url:"app,key"` // identity of app. Only used for customer webhooks.
1432 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
1433 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
1434 Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
1435 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
1436 // If `sync`, Heroku attempts multiple deliveries until the request is
1437 // successful or a limit is reached
1438 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
1439 URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
1440 }
1441
1442 // Removes an app webhook subscription.
1443 func (s *Service) AppWebhookDelete(ctx context.Context, appIdentity string, appWebhookIdentity string) (*AppWebhookDeleteResult, error) {
1444 var appWebhook AppWebhookDeleteResult
1445 return &appWebhook, s.Delete(ctx, &appWebhook, fmt.Sprintf("/apps/%v/webhooks/%v", appIdentity, appWebhookIdentity))
1446 }
1447
1448 type AppWebhookInfoResult struct {
1449 App struct {
1450 ID string `json:"id" url:"id,key"` // unique identifier of app
1451 Name string `json:"name" url:"name,key"` // unique name of app
1452 } `json:"app" url:"app,key"` // identity of app. Only used for customer webhooks.
1453 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
1454 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
1455 Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
1456 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
1457 // If `sync`, Heroku attempts multiple deliveries until the request is
1458 // successful or a limit is reached
1459 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
1460 URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
1461 }
1462
1463 // Returns the info for an app webhook subscription.
1464 func (s *Service) AppWebhookInfo(ctx context.Context, appIdentity string, appWebhookIdentity string) (*AppWebhookInfoResult, error) {
1465 var appWebhook AppWebhookInfoResult
1466 return &appWebhook, s.Get(ctx, &appWebhook, fmt.Sprintf("/apps/%v/webhooks/%v", appIdentity, appWebhookIdentity), nil, nil)
1467 }
1468
1469 type AppWebhookListResult []struct {
1470 App struct {
1471 ID string `json:"id" url:"id,key"` // unique identifier of app
1472 Name string `json:"name" url:"name,key"` // unique name of app
1473 } `json:"app" url:"app,key"` // identity of app. Only used for customer webhooks.
1474 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
1475 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
1476 Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
1477 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
1478 // If `sync`, Heroku attempts multiple deliveries until the request is
1479 // successful or a limit is reached
1480 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
1481 URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
1482 }
1483
1484 // List all webhook subscriptions for a particular app.
1485 func (s *Service) AppWebhookList(ctx context.Context, appIdentity string, lr *ListRange) (AppWebhookListResult, error) {
1486 var appWebhook AppWebhookListResult
1487 return appWebhook, s.Get(ctx, &appWebhook, fmt.Sprintf("/apps/%v/webhooks", appIdentity), nil, lr)
1488 }
1489
1490 type AppWebhookUpdateOpts struct {
1491 Authorization *string `json:"authorization,omitempty" url:"authorization,omitempty,key"` // a custom `Authorization` header that Heroku will include with all
1492 // webhook notifications
1493 Include []*string `json:"include,omitempty" url:"include,omitempty,key"` // the entities that the subscription provides notifications for
1494 Level *string `json:"level,omitempty" url:"level,omitempty,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
1495 // If `sync`, Heroku attempts multiple deliveries until the request is
1496 // successful or a limit is reached
1497 Secret *string `json:"secret,omitempty" url:"secret,omitempty,key"` // a value that Heroku will use to sign all webhook notification
1498 // requests (the signature is included in the request’s
1499 // `Heroku-Webhook-Hmac-SHA256` header)
1500 URL *string `json:"url,omitempty" url:"url,omitempty,key"` // the URL where the webhook's notification requests are sent
1501 }
1502 type AppWebhookUpdateResult struct {
1503 App struct {
1504 ID string `json:"id" url:"id,key"` // unique identifier of app
1505 Name string `json:"name" url:"name,key"` // unique name of app
1506 } `json:"app" url:"app,key"` // identity of app. Only used for customer webhooks.
1507 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
1508 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
1509 Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
1510 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
1511 // If `sync`, Heroku attempts multiple deliveries until the request is
1512 // successful or a limit is reached
1513 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
1514 URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
1515 }
1516
1517 // Updates the details of an app webhook subscription.
1518 func (s *Service) AppWebhookUpdate(ctx context.Context, appIdentity string, appWebhookIdentity string, o AppWebhookUpdateOpts) (*AppWebhookUpdateResult, error) {
1519 var appWebhook AppWebhookUpdateResult
1520 return &appWebhook, s.Patch(ctx, &appWebhook, fmt.Sprintf("/apps/%v/webhooks/%v", appIdentity, appWebhookIdentity), o)
1521 }
1522
1523 // Represents the delivery of a webhook notification, including its
1524 // current status.
1525 type AppWebhookDelivery struct {
1526 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the delivery was created
1527 Event struct {
1528 ID string `json:"id" url:"id,key"` // the event's unique identifier
1529 Include string `json:"include" url:"include,key"` // the type of entity that the event is related to
1530 } `json:"event" url:"event,key"` // identity of event
1531 ID string `json:"id" url:"id,key"` // the delivery's unique identifier
1532 LastAttempt *struct {
1533 Code *int `json:"code" url:"code,key"` // http response code received during attempt
1534 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when attempt was created
1535 ErrorClass *string `json:"error_class" url:"error_class,key"` // error class encountered during attempt
1536 ID string `json:"id" url:"id,key"` // unique identifier of attempt
1537 Status string `json:"status" url:"status,key"` // status of an attempt
1538 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when attempt was updated
1539 } `json:"last_attempt" url:"last_attempt,key"` // last attempt of a delivery
1540 NextAttemptAt *time.Time `json:"next_attempt_at" url:"next_attempt_at,key"` // when delivery will be attempted again
1541 NumAttempts int `json:"num_attempts" url:"num_attempts,key"` // number of times a delivery has been attempted
1542 Status string `json:"status" url:"status,key"` // the delivery's status
1543 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the delivery was last updated
1544 Webhook struct {
1545 ID string `json:"id" url:"id,key"` // the webhook's unique identifier
1546 Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
1547 // If `sync`, Heroku attempts multiple deliveries until the request is
1548 // successful or a limit is reached
1549 } `json:"webhook" url:"webhook,key"` // identity of webhook
1550 }
1551
1552 // Returns the info for an existing delivery.
1553 func (s *Service) AppWebhookDeliveryInfo(ctx context.Context, appIdentity string, appWebhookDeliveryIdentity string) (*AppWebhookDelivery, error) {
1554 var appWebhookDelivery AppWebhookDelivery
1555 return &appWebhookDelivery, s.Get(ctx, &appWebhookDelivery, fmt.Sprintf("/apps/%v/webhook-deliveries/%v", appIdentity, appWebhookDeliveryIdentity), nil, nil)
1556 }
1557
1558 type AppWebhookDeliveryListResult []AppWebhookDelivery
1559
1560 // Lists existing deliveries for an app.
1561 func (s *Service) AppWebhookDeliveryList(ctx context.Context, appIdentity string, lr *ListRange) (AppWebhookDeliveryListResult, error) {
1562 var appWebhookDelivery AppWebhookDeliveryListResult
1563 return appWebhookDelivery, s.Get(ctx, &appWebhookDelivery, fmt.Sprintf("/apps/%v/webhook-deliveries", appIdentity), nil, lr)
1564 }
1565
1566 // Represents a webhook event that occurred.
1567 type AppWebhookEvent struct {
1568 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when event was created
1569 ID string `json:"id" url:"id,key"` // the event's unique identifier
1570 Include string `json:"include" url:"include,key"` // the type of entity that the event is related to
1571 Payload struct {
1572 Action string `json:"action" url:"action,key"` // the type of event that occurred
1573 Actor struct {
1574 Email string `json:"email" url:"email,key"` // unique email address of account
1575 ID string `json:"id" url:"id,key"` // unique identifier of an account
1576 } `json:"actor" url:"actor,key"` // user that caused event
1577 Data struct{} `json:"data" url:"data,key"` // the current details of the event
1578 PreviousData struct{} `json:"previous_data" url:"previous_data,key"` // previous details of the event (if any)
1579 Resource string `json:"resource" url:"resource,key"` // the type of resource associated with the event
1580 Version string `json:"version" url:"version,key"` // the version of the details provided for the event
1581 } `json:"payload" url:"payload,key"` // payload of event
1582 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the event was last updated
1583 }
1584
1585 // Returns the info for a specified webhook event.
1586 func (s *Service) AppWebhookEventInfo(ctx context.Context, appIdentity string, appWebhookEventIdentity string) (*AppWebhookEvent, error) {
1587 var appWebhookEvent AppWebhookEvent
1588 return &appWebhookEvent, s.Get(ctx, &appWebhookEvent, fmt.Sprintf("/apps/%v/webhook-events/%v", appIdentity, appWebhookEventIdentity), nil, nil)
1589 }
1590
1591 type AppWebhookEventListResult []AppWebhookEvent
1592
1593 // Lists existing webhook events for an app.
1594 func (s *Service) AppWebhookEventList(ctx context.Context, appIdentity string, lr *ListRange) (AppWebhookEventListResult, error) {
1595 var appWebhookEvent AppWebhookEventListResult
1596 return appWebhookEvent, s.Get(ctx, &appWebhookEvent, fmt.Sprintf("/apps/%v/webhook-events", appIdentity), nil, lr)
1597 }
1598
1599 // An audit trail archive represents a monthly json zipped file
1600 // containing events
1601 type Archive struct {
1602 Checksum string `json:"checksum" url:"checksum,key"` // checksum for the archive
1603 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when archive was created
1604 Month string `json:"month" url:"month,key"` // month of the archive
1605 Size int `json:"size" url:"size,key"` // size of the archive in bytes
1606 URL string `json:"url" url:"url,key"` // url where to download the archive
1607 Year int `json:"year" url:"year,key"` // year of the archive
1608 }
1609
1610 // Get archive for a single month.
1611 func (s *Service) ArchiveInfo(ctx context.Context, enterpriseAccountIdentity string, archiveYear int, archiveMonth string) (*Archive, error) {
1612 var archive Archive
1613 return &archive, s.Get(ctx, &archive, fmt.Sprintf("/enterprise-accounts/%v/archives/%v/%v", enterpriseAccountIdentity, archiveYear, archiveMonth), nil, nil)
1614 }
1615
1616 // List existing archives.
1617 func (s *Service) ArchiveList(ctx context.Context, enterpriseAccountIdentity string, lr *ListRange) (*Archive, error) {
1618 var archive Archive
1619 return &archive, s.Get(ctx, &archive, fmt.Sprintf("/enterprise-accounts/%v/archives", enterpriseAccountIdentity), nil, lr)
1620 }
1621
1622 // An audit trail event represents some action on the platform
1623 type AuditTrailEvent struct {
1624 Action string `json:"action" url:"action,key"` // action for the event
1625 Actor struct {
1626 Email string `json:"email" url:"email,key"`
1627 ID string `json:"id" url:"id,key"`
1628 } `json:"actor" url:"actor,key"` // user who caused event
1629 App struct {
1630 ID string `json:"id" url:"id,key"`
1631 Name string `json:"name" url:"name,key"`
1632 } `json:"app" url:"app,key"` // app upon which event took place
1633 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when event was created
1634 Data struct{} `json:"data" url:"data,key"` // data specific to the event
1635 EnterpriseAccount struct {
1636 ID string `json:"id" url:"id,key"`
1637 Name string `json:"name" url:"name,key"`
1638 } `json:"enterprise_account" url:"enterprise_account,key"` // enterprise account on which the event happened
1639 ID string `json:"id" url:"id,key"` // unique identifier of event
1640 Owner struct {
1641 Email string `json:"email" url:"email,key"`
1642 ID string `json:"id" url:"id,key"`
1643 } `json:"owner" url:"owner,key"` // owner of the app targeted by the event
1644 Request struct {
1645 IPAddress string `json:"ip_address" url:"ip_address,key"`
1646 } `json:"request" url:"request,key"` // information about where the action was triggered
1647 Team struct {
1648 ID string `json:"id" url:"id,key"`
1649 Name string `json:"name" url:"name,key"`
1650 } `json:"team" url:"team,key"` // team on which the event happened
1651 Type string `json:"type" url:"type,key"` // type of event
1652 }
1653
1654 // List existing events. Returns all events for one day, defaulting to
1655 // current day. Order, actor, action, and type, and day query params can
1656 // be specified as query parameters. For example,
1657 // '/enterprise-accounts/:id/events?order=desc&[email protected]&act
1658 // ion=create&type=app&day=2020-09-30' would return events in descending
1659 // order and only return app created events by the user with
1660 // [email protected] email address.
1661 func (s *Service) AuditTrailEventList(ctx context.Context, enterpriseAccountIdentity string, lr *ListRange) (*AuditTrailEvent, error) {
1662 var auditTrailEvent AuditTrailEvent
1663 return &auditTrailEvent, s.Get(ctx, &auditTrailEvent, fmt.Sprintf("/enterprise-accounts/%v/events", enterpriseAccountIdentity), nil, lr)
1664 }
1665
1666 // A build represents the process of transforming a code tarball into a
1667 // slug
1668 type Build struct {
1669 App struct {
1670 ID string `json:"id" url:"id,key"` // unique identifier of app
1671 } `json:"app" url:"app,key"` // app that the build belongs to
1672 Buildpacks []struct {
1673 Name string `json:"name" url:"name,key"` // Buildpack Registry name of the buildpack for the app
1674 URL string `json:"url" url:"url,key"` // the URL of the buildpack for the app
1675 } `json:"buildpacks" url:"buildpacks,key"` // buildpacks executed for this build, in order
1676 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when build was created
1677 ID string `json:"id" url:"id,key"` // unique identifier of build
1678 OutputStreamURL string `json:"output_stream_url" url:"output_stream_url,key"` // Build process output will be available from this URL as a stream. The
1679 // stream is available as either `text/plain` or `text/event-stream`.
1680 // Clients should be prepared to handle disconnects and can resume the
1681 // stream by sending a `Range` header (for `text/plain`) or a
1682 // `Last-Event-Id` header (for `text/event-stream`).
1683 Release *struct {
1684 ID string `json:"id" url:"id,key"` // unique identifier of release
1685 } `json:"release" url:"release,key"` // release resulting from the build
1686 Slug *struct {
1687 ID string `json:"id" url:"id,key"` // unique identifier of slug
1688 } `json:"slug" url:"slug,key"` // slug created by this build
1689 SourceBlob struct {
1690 Checksum *string `json:"checksum" url:"checksum,key"` // an optional checksum of the gzipped tarball for verifying its
1691 // integrity
1692 URL string `json:"url" url:"url,key"` // URL where gzipped tar archive of source code for build was
1693 // downloaded.
1694 Version *string `json:"version" url:"version,key"` // Version of the gzipped tarball.
1695 } `json:"source_blob" url:"source_blob,key"` // location of gzipped tarball of source code used to create build
1696 Stack string `json:"stack" url:"stack,key"` // stack of build
1697 Status string `json:"status" url:"status,key"` // status of build
1698 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when build was updated
1699 User struct {
1700 Email string `json:"email" url:"email,key"` // unique email address of account
1701 ID string `json:"id" url:"id,key"` // unique identifier of an account
1702 } `json:"user" url:"user,key"` // user that started the build
1703 }
1704 type BuildCreateOpts struct {
1705 Buildpacks []*struct {
1706 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // Buildpack Registry name of the buildpack for the app
1707 URL *string `json:"url,omitempty" url:"url,omitempty,key"` // the URL of the buildpack for the app
1708 } `json:"buildpacks,omitempty" url:"buildpacks,omitempty,key"` // buildpacks executed for this build, in order
1709 SourceBlob struct {
1710 Checksum *string `json:"checksum,omitempty" url:"checksum,omitempty,key"` // an optional checksum of the gzipped tarball for verifying its
1711 // integrity
1712 URL *string `json:"url,omitempty" url:"url,omitempty,key"` // URL where gzipped tar archive of source code for build was
1713 // downloaded.
1714 Version *string `json:"version,omitempty" url:"version,omitempty,key"` // Version of the gzipped tarball.
1715 } `json:"source_blob" url:"source_blob,key"` // location of gzipped tarball of source code used to create build
1716 }
1717
1718 // Create a new build.
1719 func (s *Service) BuildCreate(ctx context.Context, appIdentity string, o BuildCreateOpts) (*Build, error) {
1720 var build Build
1721 return &build, s.Post(ctx, &build, fmt.Sprintf("/apps/%v/builds", appIdentity), o)
1722 }
1723
1724 // Info for existing build.
1725 func (s *Service) BuildInfo(ctx context.Context, appIdentity string, buildIdentity string) (*Build, error) {
1726 var build Build
1727 return &build, s.Get(ctx, &build, fmt.Sprintf("/apps/%v/builds/%v", appIdentity, buildIdentity), nil, nil)
1728 }
1729
1730 type BuildListResult []Build
1731
1732 // List existing build.
1733 func (s *Service) BuildList(ctx context.Context, appIdentity string, lr *ListRange) (BuildListResult, error) {
1734 var build BuildListResult
1735 return build, s.Get(ctx, &build, fmt.Sprintf("/apps/%v/builds", appIdentity), nil, lr)
1736 }
1737
1738 // Destroy a build cache.
1739 func (s *Service) BuildDeleteCache(ctx context.Context, appIdentity string) (*Build, error) {
1740 var build Build
1741 return &build, s.Delete(ctx, &build, fmt.Sprintf("/apps/%v/build-cache", appIdentity))
1742 }
1743
1744 // A buildpack installation represents a buildpack that will be run
1745 // against an app.
1746 type BuildpackInstallation struct {
1747 Buildpack struct {
1748 Name string `json:"name" url:"name,key"` // either the Buildpack Registry name or a URL of the buildpack for the
1749 // app
1750 URL string `json:"url" url:"url,key"` // location of the buildpack for the app. Either a url (unofficial
1751 // buildpacks) or an internal urn (heroku official buildpacks).
1752 } `json:"buildpack" url:"buildpack,key"` // buildpack
1753 Ordinal int `json:"ordinal" url:"ordinal,key"` // determines the order in which the buildpacks will execute
1754 }
1755 type BuildpackInstallationUpdateOpts struct {
1756 Updates []struct {
1757 Buildpack string `json:"buildpack" url:"buildpack,key"` // location of the buildpack for the app. Either a url (unofficial
1758 // buildpacks) or an internal urn (heroku official buildpacks).
1759 } `json:"updates" url:"updates,key"` // The buildpack attribute can accept a name, a url, or a urn.
1760 }
1761 type BuildpackInstallationUpdateResult []BuildpackInstallation
1762
1763 // Update an app's buildpack installations.
1764 func (s *Service) BuildpackInstallationUpdate(ctx context.Context, appIdentity string, o BuildpackInstallationUpdateOpts) (BuildpackInstallationUpdateResult, error) {
1765 var buildpackInstallation BuildpackInstallationUpdateResult
1766 return buildpackInstallation, s.Put(ctx, &buildpackInstallation, fmt.Sprintf("/apps/%v/buildpack-installations", appIdentity), o)
1767 }
1768
1769 type BuildpackInstallationListResult []BuildpackInstallation
1770
1771 // List an app's existing buildpack installations.
1772 func (s *Service) BuildpackInstallationList(ctx context.Context, appIdentity string, lr *ListRange) (BuildpackInstallationListResult, error) {
1773 var buildpackInstallation BuildpackInstallationListResult
1774 return buildpackInstallation, s.Get(ctx, &buildpackInstallation, fmt.Sprintf("/apps/%v/buildpack-installations", appIdentity), nil, lr)
1775 }
1776
1777 // A collaborator represents an account that has been given access to an
1778 // app on Heroku.
1779 type Collaborator struct {
1780 App struct {
1781 ID string `json:"id" url:"id,key"` // unique identifier of app
1782 Name string `json:"name" url:"name,key"` // unique name of app
1783 } `json:"app" url:"app,key"` // app collaborator belongs to
1784 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when collaborator was created
1785 ID string `json:"id" url:"id,key"` // unique identifier of collaborator
1786 Permissions []struct {
1787 Description string `json:"description" url:"description,key"` // A description of what the app permission allows.
1788 Name string `json:"name" url:"name,key"` // The name of the app permission.
1789 } `json:"permissions" url:"permissions,key"`
1790 Role *string `json:"role" url:"role,key"` // role in the team
1791 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when collaborator was updated
1792 User struct {
1793 Email string `json:"email" url:"email,key"` // unique email address of account
1794 Federated bool `json:"federated" url:"federated,key"` // whether the user is federated and belongs to an Identity Provider
1795 ID string `json:"id" url:"id,key"` // unique identifier of an account
1796 } `json:"user" url:"user,key"` // identity of collaborated account
1797 }
1798 type CollaboratorCreateOpts struct {
1799 Silent *bool `json:"silent,omitempty" url:"silent,omitempty,key"` // whether to suppress email invitation when creating collaborator
1800 User string `json:"user" url:"user,key"` // unique email address of account
1801 }
1802
1803 // Create a new collaborator.
1804 func (s *Service) CollaboratorCreate(ctx context.Context, appIdentity string, o CollaboratorCreateOpts) (*Collaborator, error) {
1805 var collaborator Collaborator
1806 return &collaborator, s.Post(ctx, &collaborator, fmt.Sprintf("/apps/%v/collaborators", appIdentity), o)
1807 }
1808
1809 // Delete an existing collaborator.
1810 func (s *Service) CollaboratorDelete(ctx context.Context, appIdentity string, collaboratorIdentity string) (*Collaborator, error) {
1811 var collaborator Collaborator
1812 return &collaborator, s.Delete(ctx, &collaborator, fmt.Sprintf("/apps/%v/collaborators/%v", appIdentity, collaboratorIdentity))
1813 }
1814
1815 // Info for existing collaborator.
1816 func (s *Service) CollaboratorInfo(ctx context.Context, appIdentity string, collaboratorIdentity string) (*Collaborator, error) {
1817 var collaborator Collaborator
1818 return &collaborator, s.Get(ctx, &collaborator, fmt.Sprintf("/apps/%v/collaborators/%v", appIdentity, collaboratorIdentity), nil, nil)
1819 }
1820
1821 type CollaboratorListResult []Collaborator
1822
1823 // List existing collaborators.
1824 func (s *Service) CollaboratorList(ctx context.Context, appIdentity string, lr *ListRange) (CollaboratorListResult, error) {
1825 var collaborator CollaboratorListResult
1826 return collaborator, s.Get(ctx, &collaborator, fmt.Sprintf("/apps/%v/collaborators", appIdentity), nil, lr)
1827 }
1828
1829 // Config Vars allow you to manage the configuration information
1830 // provided to an app on Heroku.
1831 type ConfigVar map[string]string
1832 type ConfigVarInfoForAppResult map[string]*string
1833
1834 // Get config-vars for app.
1835 func (s *Service) ConfigVarInfoForApp(ctx context.Context, appIdentity string) (ConfigVarInfoForAppResult, error) {
1836 var configVar ConfigVarInfoForAppResult
1837 return configVar, s.Get(ctx, &configVar, fmt.Sprintf("/apps/%v/config-vars", appIdentity), nil, nil)
1838 }
1839
1840 type ConfigVarInfoForAppReleaseResult map[string]*string
1841
1842 // Get config-vars for a release.
1843 func (s *Service) ConfigVarInfoForAppRelease(ctx context.Context, appIdentity string, releaseIdentity string) (ConfigVarInfoForAppReleaseResult, error) {
1844 var configVar ConfigVarInfoForAppReleaseResult
1845 return configVar, s.Get(ctx, &configVar, fmt.Sprintf("/apps/%v/releases/%v/config-vars", appIdentity, releaseIdentity), nil, nil)
1846 }
1847
1848 type ConfigVarUpdateResult map[string]*string
1849
1850 // Update config-vars for app. You can update existing config-vars by
1851 // setting them again, and remove by setting it to `null`.
1852 func (s *Service) ConfigVarUpdate(ctx context.Context, appIdentity string, o map[string]*string) (ConfigVarUpdateResult, error) {
1853 var configVar ConfigVarUpdateResult
1854 return configVar, s.Patch(ctx, &configVar, fmt.Sprintf("/apps/%v/config-vars", appIdentity), o)
1855 }
1856
1857 // A credit represents value that will be used up before further charges
1858 // are assigned to an account.
1859 type Credit struct {
1860 Amount float64 `json:"amount" url:"amount,key"` // total value of credit in cents
1861 Balance float64 `json:"balance" url:"balance,key"` // remaining value of credit in cents
1862 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when credit was created
1863 ExpiresAt time.Time `json:"expires_at" url:"expires_at,key"` // when credit will expire
1864 ID string `json:"id" url:"id,key"` // unique identifier of credit
1865 Title string `json:"title" url:"title,key"` // a name for credit
1866 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when credit was updated
1867 }
1868 type CreditCreateOpts struct {
1869 Code1 *string `json:"code1,omitempty" url:"code1,omitempty,key"` // first code from a discount card
1870 Code2 *string `json:"code2,omitempty" url:"code2,omitempty,key"` // second code from a discount card
1871 }
1872
1873 // Create a new credit.
1874 func (s *Service) CreditCreate(ctx context.Context, o CreditCreateOpts) (*Credit, error) {
1875 var credit Credit
1876 return &credit, s.Post(ctx, &credit, fmt.Sprintf("/account/credits"), o)
1877 }
1878
1879 // Info for existing credit.
1880 func (s *Service) CreditInfo(ctx context.Context, creditIdentity string) (*Credit, error) {
1881 var credit Credit
1882 return &credit, s.Get(ctx, &credit, fmt.Sprintf("/account/credits/%v", creditIdentity), nil, nil)
1883 }
1884
1885 type CreditListResult []Credit
1886
1887 // List existing credits.
1888 func (s *Service) CreditList(ctx context.Context, lr *ListRange) (CreditListResult, error) {
1889 var credit CreditListResult
1890 return credit, s.Get(ctx, &credit, fmt.Sprintf("/account/credits"), nil, lr)
1891 }
1892
1893 // Domains define what web routes should be routed to an app on Heroku.
1894 type Domain struct {
1895 AcmStatus *string `json:"acm_status" url:"acm_status,key"` // status of this record's ACM
1896 AcmStatusReason *string `json:"acm_status_reason" url:"acm_status_reason,key"` // reason for the status of this record's ACM
1897 App struct {
1898 ID string `json:"id" url:"id,key"` // unique identifier of app
1899 Name string `json:"name" url:"name,key"` // unique name of app
1900 } `json:"app" url:"app,key"` // app that owns the domain
1901 CName *string `json:"cname" url:"cname,key"` // canonical name record, the address to point a domain at
1902 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when domain was created
1903 Hostname string `json:"hostname" url:"hostname,key"` // full hostname
1904 ID string `json:"id" url:"id,key"` // unique identifier of this domain
1905 Kind string `json:"kind" url:"kind,key"` // type of domain name
1906 SniEndpoint *struct {
1907 ID string `json:"id" url:"id,key"` // unique identifier of this SNI endpoint
1908 Name string `json:"name" url:"name,key"` // unique name for SNI endpoint
1909 } `json:"sni_endpoint" url:"sni_endpoint,key"` // sni endpoint the domain is associated with
1910 Status string `json:"status" url:"status,key"` // status of this record's cname
1911 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when domain was updated
1912 }
1913 type DomainCreateOpts struct {
1914 Hostname string `json:"hostname" url:"hostname,key"` // full hostname
1915 SniEndpoint *string `json:"sni_endpoint" url:"sni_endpoint,key"` // null or unique identifier or name for SNI endpoint
1916 }
1917
1918 // Create a new domain.
1919 func (s *Service) DomainCreate(ctx context.Context, appIdentity string, o DomainCreateOpts) (*Domain, error) {
1920 var domain Domain
1921 return &domain, s.Post(ctx, &domain, fmt.Sprintf("/apps/%v/domains", appIdentity), o)
1922 }
1923
1924 type DomainUpdateOpts struct {
1925 SniEndpoint *string `json:"sni_endpoint" url:"sni_endpoint,key"` // null or unique identifier or name for SNI endpoint
1926 }
1927
1928 // Associate an SNI endpoint
1929 func (s *Service) DomainUpdate(ctx context.Context, appIdentity string, domainIdentity string, o DomainUpdateOpts) (*Domain, error) {
1930 var domain Domain
1931 return &domain, s.Patch(ctx, &domain, fmt.Sprintf("/apps/%v/domains/%v", appIdentity, domainIdentity), o)
1932 }
1933
1934 // Delete an existing domain
1935 func (s *Service) DomainDelete(ctx context.Context, appIdentity string, domainIdentity string) (*Domain, error) {
1936 var domain Domain
1937 return &domain, s.Delete(ctx, &domain, fmt.Sprintf("/apps/%v/domains/%v", appIdentity, domainIdentity))
1938 }
1939
1940 // Info for existing domain.
1941 func (s *Service) DomainInfo(ctx context.Context, appIdentity string, domainIdentity string) (*Domain, error) {
1942 var domain Domain
1943 return &domain, s.Get(ctx, &domain, fmt.Sprintf("/apps/%v/domains/%v", appIdentity, domainIdentity), nil, nil)
1944 }
1945
1946 type DomainListResult []Domain
1947
1948 // List existing domains.
1949 func (s *Service) DomainList(ctx context.Context, appIdentity string, lr *ListRange) (DomainListResult, error) {
1950 var domain DomainListResult
1951 return domain, s.Get(ctx, &domain, fmt.Sprintf("/apps/%v/domains", appIdentity), nil, lr)
1952 }
1953
1954 // Dynos encapsulate running processes of an app on Heroku. Detailed
1955 // information about dyno sizes can be found at:
1956 // [https://devcenter.heroku.com/articles/dyno-types](https://devcenter.h
1957 // eroku.com/articles/dyno-types).
1958 type Dyno struct {
1959 App struct {
1960 ID string `json:"id" url:"id,key"` // unique identifier of app
1961 Name string `json:"name" url:"name,key"` // unique name of app
1962 } `json:"app" url:"app,key"` // app formation belongs to
1963 AttachURL *string `json:"attach_url" url:"attach_url,key"` // a URL to stream output from for attached processes or null for
1964 // non-attached processes
1965 Command string `json:"command" url:"command,key"` // command used to start this process
1966 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when dyno was created
1967 ID string `json:"id" url:"id,key"` // unique identifier of this dyno
1968 Name string `json:"name" url:"name,key"` // the name of this process on this dyno
1969 Release struct {
1970 ID string `json:"id" url:"id,key"` // unique identifier of release
1971 Version int `json:"version" url:"version,key"` // unique version assigned to the release
1972 } `json:"release" url:"release,key"` // app release of the dyno
1973 Size string `json:"size" url:"size,key"` // dyno size (default: "standard-1X")
1974 State string `json:"state" url:"state,key"` // current status of process (either: crashed, down, idle, starting, or
1975 // up)
1976 Type string `json:"type" url:"type,key"` // type of process
1977 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when process last changed state
1978 }
1979 type DynoCreateOpts struct {
1980 Attach *bool `json:"attach,omitempty" url:"attach,omitempty,key"` // whether to stream output or not
1981 Command string `json:"command" url:"command,key"` // command used to start this process
1982 Env map[string]string `json:"env,omitempty" url:"env,omitempty,key"` // custom environment to add to the dyno config vars
1983 ForceNoTty *bool `json:"force_no_tty,omitempty" url:"force_no_tty,omitempty,key"` // force an attached one-off dyno to not run in a tty
1984 Size *string `json:"size,omitempty" url:"size,omitempty,key"` // dyno size (default: "standard-1X")
1985 TimeToLive *int `json:"time_to_live,omitempty" url:"time_to_live,omitempty,key"` // seconds until dyno expires, after which it will soon be killed, max
1986 // 86400 seconds (24 hours)
1987 Type *string `json:"type,omitempty" url:"type,omitempty,key"` // type of process
1988 }
1989
1990 // Create a new dyno.
1991 func (s *Service) DynoCreate(ctx context.Context, appIdentity string, o DynoCreateOpts) (*Dyno, error) {
1992 var dyno Dyno
1993 return &dyno, s.Post(ctx, &dyno, fmt.Sprintf("/apps/%v/dynos", appIdentity), o)
1994 }
1995
1996 type DynoRestartResult struct{}
1997
1998 // Restart dyno.
1999 func (s *Service) DynoRestart(ctx context.Context, appIdentity string, dynoIdentity string) (DynoRestartResult, error) {
2000 var dyno DynoRestartResult
2001 return dyno, s.Delete(ctx, &dyno, fmt.Sprintf("/apps/%v/dynos/%v", appIdentity, dynoIdentity))
2002 }
2003
2004 type DynoRestartAllResult struct{}
2005
2006 // Restart all dynos.
2007 func (s *Service) DynoRestartAll(ctx context.Context, appIdentity string) (DynoRestartAllResult, error) {
2008 var dyno DynoRestartAllResult
2009 return dyno, s.Delete(ctx, &dyno, fmt.Sprintf("/apps/%v/dynos", appIdentity))
2010 }
2011
2012 type DynoStopResult struct{}
2013
2014 // Stop dyno.
2015 func (s *Service) DynoStop(ctx context.Context, appIdentity string, dynoIdentity string) (DynoStopResult, error) {
2016 var dyno DynoStopResult
2017 return dyno, s.Post(ctx, &dyno, fmt.Sprintf("/apps/%v/dynos/%v/actions/stop", appIdentity, dynoIdentity), nil)
2018 }
2019
2020 // Info for existing dyno.
2021 func (s *Service) DynoInfo(ctx context.Context, appIdentity string, dynoIdentity string) (*Dyno, error) {
2022 var dyno Dyno
2023 return &dyno, s.Get(ctx, &dyno, fmt.Sprintf("/apps/%v/dynos/%v", appIdentity, dynoIdentity), nil, nil)
2024 }
2025
2026 type DynoListResult []Dyno
2027
2028 // List existing dynos.
2029 func (s *Service) DynoList(ctx context.Context, appIdentity string, lr *ListRange) (DynoListResult, error) {
2030 var dyno DynoListResult
2031 return dyno, s.Get(ctx, &dyno, fmt.Sprintf("/apps/%v/dynos", appIdentity), nil, lr)
2032 }
2033
2034 // Dyno sizes are the values and details of sizes that can be assigned
2035 // to dynos. This information can also be found at :
2036 // [https://devcenter.heroku.com/articles/dyno-types](https://devcenter.h
2037 // eroku.com/articles/dyno-types).
2038 type DynoSize struct {
2039 Compute int `json:"compute" url:"compute,key"` // minimum vCPUs, non-dedicated may get more depending on load
2040 Cost *struct{} `json:"cost" url:"cost,key"` // price information for this dyno size
2041 Dedicated bool `json:"dedicated" url:"dedicated,key"` // whether this dyno will be dedicated to one user
2042 DynoUnits int `json:"dyno_units" url:"dyno_units,key"` // unit of consumption for Heroku Enterprise customers
2043 ID string `json:"id" url:"id,key"` // unique identifier of this dyno size
2044 Memory float64 `json:"memory" url:"memory,key"` // amount of RAM in GB
2045 Name string `json:"name" url:"name,key"` // the name of this dyno-size
2046 PrivateSpaceOnly bool `json:"private_space_only" url:"private_space_only,key"` // whether this dyno can only be provisioned in a private space
2047 }
2048
2049 // Info for existing dyno size.
2050 func (s *Service) DynoSizeInfo(ctx context.Context, dynoSizeIdentity string) (*DynoSize, error) {
2051 var dynoSize DynoSize
2052 return &dynoSize, s.Get(ctx, &dynoSize, fmt.Sprintf("/dyno-sizes/%v", dynoSizeIdentity), nil, nil)
2053 }
2054
2055 type DynoSizeListResult []DynoSize
2056
2057 // List existing dyno sizes.
2058 func (s *Service) DynoSizeList(ctx context.Context, lr *ListRange) (DynoSizeListResult, error) {
2059 var dynoSize DynoSizeListResult
2060 return dynoSize, s.Get(ctx, &dynoSize, fmt.Sprintf("/dyno-sizes"), nil, lr)
2061 }
2062
2063 // Enterprise accounts allow companies to manage their development teams
2064 // and billing.
2065 type EnterpriseAccount struct {
2066 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the enterprise account was created
2067 ID string `json:"id" url:"id,key"` // unique identifier of the enterprise account
2068 IdentityProvider *struct {
2069 ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
2070 Name string `json:"name" url:"name,key"` // user-friendly unique identifier for this identity provider
2071 Owner struct {
2072 ID string `json:"id" url:"id,key"` // unique identifier of the owner
2073 Name string `json:"name" url:"name,key"` // name of the owner
2074 Type string `json:"type" url:"type,key"` // type of the owner
2075 } `json:"owner" url:"owner,key"` // entity that owns this identity provider
2076 } `json:"identity_provider" url:"identity_provider,key"` // Identity Provider associated with the Enterprise Account
2077 Name string `json:"name" url:"name,key"` // unique name of the enterprise account
2078 Permissions []string `json:"permissions" url:"permissions,key"` // the current user's permissions for this enterprise account
2079 Trial bool `json:"trial" url:"trial,key"` // whether the enterprise account is a trial or not
2080 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the enterprise account was updated
2081 }
2082 type EnterpriseAccountListResult []EnterpriseAccount
2083
2084 // List enterprise accounts in which you are a member.
2085 func (s *Service) EnterpriseAccountList(ctx context.Context, lr *ListRange) (EnterpriseAccountListResult, error) {
2086 var enterpriseAccount EnterpriseAccountListResult
2087 return enterpriseAccount, s.Get(ctx, &enterpriseAccount, fmt.Sprintf("/enterprise-accounts"), nil, lr)
2088 }
2089
2090 // Information about an enterprise account.
2091 func (s *Service) EnterpriseAccountInfo(ctx context.Context, enterpriseAccountIdentity string) (*EnterpriseAccount, error) {
2092 var enterpriseAccount EnterpriseAccount
2093 return &enterpriseAccount, s.Get(ctx, &enterpriseAccount, fmt.Sprintf("/enterprise-accounts/%v", enterpriseAccountIdentity), nil, nil)
2094 }
2095
2096 type EnterpriseAccountUpdateOpts struct {
2097 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of the enterprise account
2098 }
2099
2100 // Update enterprise account properties
2101 func (s *Service) EnterpriseAccountUpdate(ctx context.Context, enterpriseAccountIdentity string, o EnterpriseAccountUpdateOpts) (*EnterpriseAccount, error) {
2102 var enterpriseAccount EnterpriseAccount
2103 return &enterpriseAccount, s.Patch(ctx, &enterpriseAccount, fmt.Sprintf("/enterprise-accounts/%v", enterpriseAccountIdentity), o)
2104 }
2105
2106 // Usage for an enterprise account at a daily resolution.
2107 type EnterpriseAccountDailyUsage struct {
2108 Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
2109 Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
2110 Date string `json:"date" url:"date,key"` // date of the usage
2111 Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
2112 ID string `json:"id" url:"id,key"` // enterprise account identifier
2113 Name string `json:"name" url:"name,key"` // name of the enterprise account
2114 Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
2115 Space float64 `json:"space" url:"space,key"` // space credits used
2116 Teams []struct {
2117 Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
2118 Apps []struct {
2119 Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
2120 AppName string `json:"app_name" url:"app_name,key"` // unique name of app
2121 Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
2122 Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
2123 Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
2124 } `json:"apps" url:"apps,key"` // app usage in the team
2125 Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
2126 Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
2127 ID string `json:"id" url:"id,key"` // team identifier
2128 Name string `json:"name" url:"name,key"` // name of the team
2129 Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
2130 Space float64 `json:"space" url:"space,key"` // space credits used
2131 } `json:"teams" url:"teams,key"` // usage by team
2132 }
2133 type EnterpriseAccountDailyUsageInfoOpts struct {
2134 End *string `json:"end,omitempty" url:"end,omitempty,key"` // range end date
2135 Start string `json:"start" url:"start,key"` // range start date
2136 }
2137 type EnterpriseAccountDailyUsageInfoResult []EnterpriseAccountDailyUsage
2138
2139 // Retrieves usage for an enterprise account for a range of days. Start
2140 // and end dates can be specified as query parameters using the date
2141 // format YYYY-MM-DD. The enterprise account identifier can be found
2142 // from the [enterprise account
2143 // list](https://devcenter.heroku.com/articles/platform-api-reference#ent
2144 // erprise-account-list).
2145 //
2146 func (s *Service) EnterpriseAccountDailyUsageInfo(ctx context.Context, enterpriseAccountID string, o EnterpriseAccountDailyUsageInfoOpts, lr *ListRange) (EnterpriseAccountDailyUsageInfoResult, error) {
2147 var enterpriseAccountDailyUsage EnterpriseAccountDailyUsageInfoResult
2148 return enterpriseAccountDailyUsage, s.Get(ctx, &enterpriseAccountDailyUsage, fmt.Sprintf("/enterprise-accounts/%v/usage/daily", enterpriseAccountID), o, lr)
2149 }
2150
2151 // Enterprise account members are users with access to an enterprise
2152 // account.
2153 type EnterpriseAccountMember struct {
2154 EnterpriseAccount struct {
2155 ID string `json:"id" url:"id,key"` // unique identifier of the enterprise account
2156 Name string `json:"name" url:"name,key"` // unique name of the enterprise account
2157 } `json:"enterprise_account" url:"enterprise_account,key"`
2158 ID string `json:"id" url:"id,key"` // unique identifier of the member
2159 IdentityProvider *struct {
2160 ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
2161 Name string `json:"name" url:"name,key"` // name of the identity provider
2162 Owner struct {
2163 ID string `json:"id" url:"id,key"` // unique identifier of the owner
2164 Name string `json:"name" url:"name,key"` // name of the owner
2165 Type string `json:"type" url:"type,key"` // type of the owner
2166 } `json:"owner" url:"owner,key"` // entity that owns this identity provider
2167 Redacted bool `json:"redacted" url:"redacted,key"` // whether the identity_provider information is redacted or not
2168 } `json:"identity_provider" url:"identity_provider,key"` // Identity Provider information the member is federated with
2169 Permissions []struct {
2170 Description string `json:"description" url:"description,key"`
2171 Name string `json:"name" url:"name,key"` // permission in the enterprise account
2172 } `json:"permissions" url:"permissions,key"` // enterprise account permissions
2173 TwoFactorAuthentication bool `json:"two_factor_authentication" url:"two_factor_authentication,key"` // whether the Enterprise Account member has two factor authentication
2174 // enabled
2175 User struct {
2176 Email string `json:"email" url:"email,key"` // unique email address of account
2177 ID string `json:"id" url:"id,key"` // unique identifier of an account
2178 } `json:"user" url:"user,key"` // user information for the membership
2179 }
2180 type EnterpriseAccountMemberListResult []EnterpriseAccountMember
2181
2182 // List members in an enterprise account.
2183 func (s *Service) EnterpriseAccountMemberList(ctx context.Context, enterpriseAccountIdentity string, lr *ListRange) (EnterpriseAccountMemberListResult, error) {
2184 var enterpriseAccountMember EnterpriseAccountMemberListResult
2185 return enterpriseAccountMember, s.Get(ctx, &enterpriseAccountMember, fmt.Sprintf("/enterprise-accounts/%v/members", enterpriseAccountIdentity), nil, lr)
2186 }
2187
2188 type EnterpriseAccountMemberCreateOpts struct {
2189 Federated *bool `json:"federated,omitempty" url:"federated,omitempty,key"` // whether membership is being created as part of SSO JIT
2190 Permissions []string `json:"permissions" url:"permissions,key"` // permissions for enterprise account
2191 User string `json:"user" url:"user,key"` // unique email address of account
2192 }
2193
2194 // Create a member in an enterprise account.
2195 func (s *Service) EnterpriseAccountMemberCreate(ctx context.Context, enterpriseAccountIdentity string, o EnterpriseAccountMemberCreateOpts) (*EnterpriseAccountMember, error) {
2196 var enterpriseAccountMember EnterpriseAccountMember
2197 return &enterpriseAccountMember, s.Post(ctx, &enterpriseAccountMember, fmt.Sprintf("/enterprise-accounts/%v/members", enterpriseAccountIdentity), o)
2198 }
2199
2200 type EnterpriseAccountMemberUpdateOpts struct {
2201 Permissions []string `json:"permissions" url:"permissions,key"` // permissions for enterprise account
2202 }
2203
2204 // Update a member in an enterprise account.
2205 func (s *Service) EnterpriseAccountMemberUpdate(ctx context.Context, enterpriseAccountIdentity string, enterpriseAccountMemberUserIdentity string, o EnterpriseAccountMemberUpdateOpts) (*EnterpriseAccountMember, error) {
2206 var enterpriseAccountMember EnterpriseAccountMember
2207 return &enterpriseAccountMember, s.Patch(ctx, &enterpriseAccountMember, fmt.Sprintf("/enterprise-accounts/%v/members/%v", enterpriseAccountIdentity, enterpriseAccountMemberUserIdentity), o)
2208 }
2209
2210 // delete a member in an enterprise account.
2211 func (s *Service) EnterpriseAccountMemberDelete(ctx context.Context, enterpriseAccountIdentity string, enterpriseAccountMemberUserIdentity string) (*EnterpriseAccountMember, error) {
2212 var enterpriseAccountMember EnterpriseAccountMember
2213 return &enterpriseAccountMember, s.Delete(ctx, &enterpriseAccountMember, fmt.Sprintf("/enterprise-accounts/%v/members/%v", enterpriseAccountIdentity, enterpriseAccountMemberUserIdentity))
2214 }
2215
2216 // Usage for an enterprise account at a monthly resolution.
2217 type EnterpriseAccountMonthlyUsage struct {
2218 Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
2219 Connect float64 `json:"connect" url:"connect,key"` // average connect rows synced
2220 Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
2221 Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
2222 ID string `json:"id" url:"id,key"` // enterprise account identifier
2223 Month string `json:"month" url:"month,key"` // year and month of the usage
2224 Name string `json:"name" url:"name,key"` // name of the enterprise account
2225 Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
2226 Space float64 `json:"space" url:"space,key"` // space credits used
2227 Teams []struct {
2228 Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
2229 Apps []struct {
2230 Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
2231 AppName string `json:"app_name" url:"app_name,key"` // unique name of app
2232 Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
2233 Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
2234 Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
2235 } `json:"apps" url:"apps,key"` // app usage in the team
2236 Connect float64 `json:"connect" url:"connect,key"` // average connect rows synced
2237 Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
2238 Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
2239 ID string `json:"id" url:"id,key"` // team identifier
2240 Name string `json:"name" url:"name,key"` // name of the team
2241 Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
2242 Space float64 `json:"space" url:"space,key"` // space credits used
2243 } `json:"teams" url:"teams,key"` // usage by team
2244 }
2245 type EnterpriseAccountMonthlyUsageInfoOpts struct {
2246 End *string `json:"end,omitempty" url:"end,omitempty,key"` // range end date
2247 Start string `json:"start" url:"start,key"` // range start date
2248 }
2249 type EnterpriseAccountMonthlyUsageInfoResult []EnterpriseAccountMonthlyUsage
2250
2251 // Retrieves usage for an enterprise account for a range of months.
2252 // Start and end dates can be specified as query parameters using the
2253 // date format YYYY-MM. If no end date is specified, one month of usage
2254 // is returned. The enterprise account identifier can be found from the
2255 // [enterprise account
2256 // list](https://devcenter.heroku.com/articles/platform-api-reference#ent
2257 // erprise-account-list).
2258 //
2259 func (s *Service) EnterpriseAccountMonthlyUsageInfo(ctx context.Context, enterpriseAccountID string, o EnterpriseAccountMonthlyUsageInfoOpts, lr *ListRange) (EnterpriseAccountMonthlyUsageInfoResult, error) {
2260 var enterpriseAccountMonthlyUsage EnterpriseAccountMonthlyUsageInfoResult
2261 return enterpriseAccountMonthlyUsage, s.Get(ctx, &enterpriseAccountMonthlyUsage, fmt.Sprintf("/enterprise-accounts/%v/usage/monthly", enterpriseAccountID), o, lr)
2262 }
2263
2264 // Filters are special endpoints to allow for API consumers to specify a
2265 // subset of resources to consume in order to reduce the number of
2266 // requests that are performed. Each filter endpoint endpoint is
2267 // responsible for determining its supported request format. The
2268 // endpoints are over POST in order to handle large request bodies
2269 // without hitting request uri query length limitations, but the
2270 // requests themselves are idempotent and will not have side effects.
2271 type FilterApps struct{}
2272 type FilterAppsAppsOpts struct {
2273 In *struct {
2274 ID []*string `json:"id,omitempty" url:"id,omitempty,key"`
2275 } `json:"in,omitempty" url:"in,omitempty,key"`
2276 }
2277 type FilterAppsAppsResult []struct {
2278 ArchivedAt *time.Time `json:"archived_at" url:"archived_at,key"` // when app was archived
2279 BuildStack struct {
2280 ID string `json:"id" url:"id,key"` // unique identifier of stack
2281 Name string `json:"name" url:"name,key"` // unique name of stack
2282 } `json:"build_stack" url:"build_stack,key"` // identity of the stack that will be used for new builds
2283 BuildpackProvidedDescription *string `json:"buildpack_provided_description" url:"buildpack_provided_description,key"` // description from buildpack of app
2284 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app was created
2285 GitURL string `json:"git_url" url:"git_url,key"` // git repo URL of app
2286 ID string `json:"id" url:"id,key"` // unique identifier of app
2287 InternalRouting *bool `json:"internal_routing" url:"internal_routing,key"` // describes whether a Private Spaces app is externally routable or not
2288 Joined bool `json:"joined" url:"joined,key"` // is the current member a collaborator on this app.
2289 Locked bool `json:"locked" url:"locked,key"` // are other team members forbidden from joining this app.
2290 Maintenance bool `json:"maintenance" url:"maintenance,key"` // maintenance status of app
2291 Name string `json:"name" url:"name,key"` // unique name of app
2292 Owner *struct {
2293 Email string `json:"email" url:"email,key"` // unique email address of account
2294 ID string `json:"id" url:"id,key"` // unique identifier of an account
2295 } `json:"owner" url:"owner,key"` // identity of app owner
2296 Region struct {
2297 ID string `json:"id" url:"id,key"` // unique identifier of region
2298 Name string `json:"name" url:"name,key"` // unique name of region
2299 } `json:"region" url:"region,key"` // identity of app region
2300 ReleasedAt *time.Time `json:"released_at" url:"released_at,key"` // when app was released
2301 RepoSize *int `json:"repo_size" url:"repo_size,key"` // git repo size in bytes of app
2302 SlugSize *int `json:"slug_size" url:"slug_size,key"` // slug size in bytes of app
2303 Space *struct {
2304 ID string `json:"id" url:"id,key"` // unique identifier of space
2305 Name string `json:"name" url:"name,key"` // unique name of space
2306 } `json:"space" url:"space,key"` // identity of space
2307 Stack struct {
2308 ID string `json:"id" url:"id,key"` // unique identifier of stack
2309 Name string `json:"name" url:"name,key"` // unique name of stack
2310 } `json:"stack" url:"stack,key"` // identity of app stack
2311 Team *struct {
2312 Name string `json:"name" url:"name,key"` // unique name of team
2313 } `json:"team" url:"team,key"` // team that owns this app
2314 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app was updated
2315 WebURL string `json:"web_url" url:"web_url,key"` // web URL of app
2316 }
2317
2318 // Request an apps list filtered by app id.
2319 func (s *Service) FilterAppsApps(ctx context.Context, o FilterAppsAppsOpts) (FilterAppsAppsResult, error) {
2320 var filterApps FilterAppsAppsResult
2321 return filterApps, s.Post(ctx, &filterApps, fmt.Sprintf("/filters/apps"), o)
2322 }
2323
2324 // The formation of processes that should be maintained for an app.
2325 // Update the formation to scale processes or change dyno sizes.
2326 // Available process type names and commands are defined by the
2327 // `process_types` attribute for the [slug](#slug) currently released on
2328 // an app.
2329 type Formation struct {
2330 App struct {
2331 ID string `json:"id" url:"id,key"` // unique identifier of app
2332 Name string `json:"name" url:"name,key"` // unique name of app
2333 } `json:"app" url:"app,key"` // app formation belongs to
2334 Command string `json:"command" url:"command,key"` // command to use to launch this process
2335 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when process type was created
2336 ID string `json:"id" url:"id,key"` // unique identifier of this process type
2337 Quantity int `json:"quantity" url:"quantity,key"` // number of processes to maintain
2338 Size string `json:"size" url:"size,key"` // dyno size (default: "standard-1X")
2339 Type string `json:"type" url:"type,key"` // type of process to maintain
2340 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when dyno type was updated
2341 }
2342
2343 // Info for a process type
2344 func (s *Service) FormationInfo(ctx context.Context, appIdentity string, formationIdentity string) (*Formation, error) {
2345 var formation Formation
2346 return &formation, s.Get(ctx, &formation, fmt.Sprintf("/apps/%v/formation/%v", appIdentity, formationIdentity), nil, nil)
2347 }
2348
2349 type FormationListResult []Formation
2350
2351 // List process type formation
2352 func (s *Service) FormationList(ctx context.Context, appIdentity string, lr *ListRange) (FormationListResult, error) {
2353 var formation FormationListResult
2354 return formation, s.Get(ctx, &formation, fmt.Sprintf("/apps/%v/formation", appIdentity), nil, lr)
2355 }
2356
2357 type FormationBatchUpdateOpts struct {
2358 Updates []struct {
2359 Quantity *int `json:"quantity,omitempty" url:"quantity,omitempty,key"` // number of processes to maintain
2360 Size *string `json:"size,omitempty" url:"size,omitempty,key"` // dyno size (default: "standard-1X")
2361 Type string `json:"type" url:"type,key"` // type of process to maintain
2362 } `json:"updates" url:"updates,key"` // Array with formation updates. Each element must have "type", the id
2363 // or name of the process type to be updated, and can optionally update
2364 // its "quantity" or "size".
2365 }
2366 type FormationBatchUpdateResult []Formation
2367
2368 // Batch update process types
2369 func (s *Service) FormationBatchUpdate(ctx context.Context, appIdentity string, o FormationBatchUpdateOpts) (FormationBatchUpdateResult, error) {
2370 var formation FormationBatchUpdateResult
2371 return formation, s.Patch(ctx, &formation, fmt.Sprintf("/apps/%v/formation", appIdentity), o)
2372 }
2373
2374 type FormationUpdateOpts struct {
2375 Quantity *int `json:"quantity,omitempty" url:"quantity,omitempty,key"` // number of processes to maintain
2376 Size *string `json:"size,omitempty" url:"size,omitempty,key"` // dyno size (default: "standard-1X")
2377 }
2378
2379 // Update process type
2380 func (s *Service) FormationUpdate(ctx context.Context, appIdentity string, formationIdentity string, o FormationUpdateOpts) (*Formation, error) {
2381 var formation Formation
2382 return &formation, s.Patch(ctx, &formation, fmt.Sprintf("/apps/%v/formation/%v", appIdentity, formationIdentity), o)
2383 }
2384
2385 // Identity Providers represent the SAML configuration of an Enterprise
2386 // Account or Team.
2387 type IdentityProvider struct {
2388 Certificate string `json:"certificate" url:"certificate,key"` // raw contents of the public certificate (eg: .crt or .pem file)
2389 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when provider record was created
2390 EntityID string `json:"entity_id" url:"entity_id,key"` // URL identifier provided by the identity provider
2391 ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
2392 Organization *struct {
2393 Name string `json:"name" url:"name,key"` // unique name of team
2394 } `json:"organization" url:"organization,key"` // team associated with this identity provider
2395 Owner struct {
2396 ID string `json:"id" url:"id,key"` // unique identifier of the owner
2397 Name string `json:"name" url:"name,key"` // name of the owner
2398 Type string `json:"type" url:"type,key"` // type of the owner
2399 } `json:"owner" url:"owner,key"` // entity that owns this identity provider
2400 SloTargetURL string `json:"slo_target_url" url:"slo_target_url,key"` // single log out URL for this identity provider
2401 SsoTargetURL string `json:"sso_target_url" url:"sso_target_url,key"` // single sign on URL for this identity provider
2402 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the identity provider record was updated
2403 }
2404 type IdentityProviderListByTeamResult []IdentityProvider
2405
2406 // Get a list of a team's Identity Providers
2407 func (s *Service) IdentityProviderListByTeam(ctx context.Context, teamName string, lr *ListRange) (IdentityProviderListByTeamResult, error) {
2408 var identityProvider IdentityProviderListByTeamResult
2409 return identityProvider, s.Get(ctx, &identityProvider, fmt.Sprintf("/teams/%v/identity-providers", teamName), nil, lr)
2410 }
2411
2412 type IdentityProviderCreateByTeamOpts struct {
2413 Certificate string `json:"certificate" url:"certificate,key"` // raw contents of the public certificate (eg: .crt or .pem file)
2414 EntityID string `json:"entity_id" url:"entity_id,key"` // URL identifier provided by the identity provider
2415 SloTargetURL *string `json:"slo_target_url,omitempty" url:"slo_target_url,omitempty,key"` // single log out URL for this identity provider
2416 SsoTargetURL string `json:"sso_target_url" url:"sso_target_url,key"` // single sign on URL for this identity provider
2417 }
2418
2419 // Create an Identity Provider for a team
2420 func (s *Service) IdentityProviderCreateByTeam(ctx context.Context, teamName string, o IdentityProviderCreateByTeamOpts) (*IdentityProvider, error) {
2421 var identityProvider IdentityProvider
2422 return &identityProvider, s.Post(ctx, &identityProvider, fmt.Sprintf("/teams/%v/identity-providers", teamName), o)
2423 }
2424
2425 type IdentityProviderUpdateByTeamOpts struct {
2426 Certificate *string `json:"certificate,omitempty" url:"certificate,omitempty,key"` // raw contents of the public certificate (eg: .crt or .pem file)
2427 EntityID *string `json:"entity_id,omitempty" url:"entity_id,omitempty,key"` // URL identifier provided by the identity provider
2428 SloTargetURL *string `json:"slo_target_url,omitempty" url:"slo_target_url,omitempty,key"` // single log out URL for this identity provider
2429 SsoTargetURL *string `json:"sso_target_url,omitempty" url:"sso_target_url,omitempty,key"` // single sign on URL for this identity provider
2430 }
2431
2432 // Update a team's Identity Provider
2433 func (s *Service) IdentityProviderUpdateByTeam(ctx context.Context, teamName string, identityProviderID string, o IdentityProviderUpdateByTeamOpts) (*IdentityProvider, error) {
2434 var identityProvider IdentityProvider
2435 return &identityProvider, s.Patch(ctx, &identityProvider, fmt.Sprintf("/teams/%v/identity-providers/%v", teamName, identityProviderID), o)
2436 }
2437
2438 // Delete a team's Identity Provider
2439 func (s *Service) IdentityProviderDeleteByTeam(ctx context.Context, teamName string, identityProviderID string) (*IdentityProvider, error) {
2440 var identityProvider IdentityProvider
2441 return &identityProvider, s.Delete(ctx, &identityProvider, fmt.Sprintf("/teams/%v/identity-providers/%v", teamName, identityProviderID))
2442 }
2443
2444 // An inbound-ruleset is a collection of rules that specify what hosts
2445 // can or cannot connect to an application.
2446 type InboundRuleset struct {
2447 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when inbound-ruleset was created
2448 CreatedBy string `json:"created_by" url:"created_by,key"` // unique email address of account
2449 ID string `json:"id" url:"id,key"` // unique identifier of an inbound-ruleset
2450 Rules []struct {
2451 Action string `json:"action" url:"action,key"` // states whether the connection is allowed or denied
2452 Source string `json:"source" url:"source,key"` // is the request’s source in CIDR notation
2453 } `json:"rules" url:"rules,key"`
2454 Space struct {
2455 ID string `json:"id" url:"id,key"` // unique identifier of space
2456 Name string `json:"name" url:"name,key"` // unique name of space
2457 } `json:"space" url:"space,key"` // identity of space
2458 }
2459
2460 // Current inbound ruleset for a space
2461 func (s *Service) InboundRulesetCurrent(ctx context.Context, spaceIdentity string) (*InboundRuleset, error) {
2462 var inboundRuleset InboundRuleset
2463 return &inboundRuleset, s.Get(ctx, &inboundRuleset, fmt.Sprintf("/spaces/%v/inbound-ruleset", spaceIdentity), nil, nil)
2464 }
2465
2466 // Info on an existing Inbound Ruleset
2467 func (s *Service) InboundRulesetInfo(ctx context.Context, spaceIdentity string, inboundRulesetIdentity string) (*InboundRuleset, error) {
2468 var inboundRuleset InboundRuleset
2469 return &inboundRuleset, s.Get(ctx, &inboundRuleset, fmt.Sprintf("/spaces/%v/inbound-rulesets/%v", spaceIdentity, inboundRulesetIdentity), nil, nil)
2470 }
2471
2472 type InboundRulesetListResult []InboundRuleset
2473
2474 // List all inbound rulesets for a space
2475 func (s *Service) InboundRulesetList(ctx context.Context, spaceIdentity string, lr *ListRange) (InboundRulesetListResult, error) {
2476 var inboundRuleset InboundRulesetListResult
2477 return inboundRuleset, s.Get(ctx, &inboundRuleset, fmt.Sprintf("/spaces/%v/inbound-rulesets", spaceIdentity), nil, lr)
2478 }
2479
2480 type InboundRulesetCreateOpts struct {
2481 Rules []*struct {
2482 Action string `json:"action" url:"action,key"` // states whether the connection is allowed or denied
2483 Source string `json:"source" url:"source,key"` // is the request’s source in CIDR notation
2484 } `json:"rules,omitempty" url:"rules,omitempty,key"`
2485 }
2486
2487 // Create a new inbound ruleset
2488 func (s *Service) InboundRulesetCreate(ctx context.Context, spaceIdentity string, o InboundRulesetCreateOpts) (*InboundRuleset, error) {
2489 var inboundRuleset InboundRuleset
2490 return &inboundRuleset, s.Put(ctx, &inboundRuleset, fmt.Sprintf("/spaces/%v/inbound-ruleset", spaceIdentity), o)
2491 }
2492
2493 // An invoice is an itemized bill of goods for an account which includes
2494 // pricing and charges.
2495 type Invoice struct {
2496 ChargesTotal float64 `json:"charges_total" url:"charges_total,key"` // total charges on this invoice
2497 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when invoice was created
2498 CreditsTotal float64 `json:"credits_total" url:"credits_total,key"` // total credits on this invoice
2499 ID string `json:"id" url:"id,key"` // unique identifier of this invoice
2500 Number int `json:"number" url:"number,key"` // human readable invoice number
2501 PeriodEnd string `json:"period_end" url:"period_end,key"` // the ending date that the invoice covers
2502 PeriodStart string `json:"period_start" url:"period_start,key"` // the starting date that this invoice covers
2503 State int `json:"state" url:"state,key"` // payment status for this invoice (pending, successful, failed)
2504 Total float64 `json:"total" url:"total,key"` // combined total of charges and credits on this invoice
2505 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when invoice was updated
2506 }
2507
2508 // Info for existing invoice.
2509 func (s *Service) InvoiceInfo(ctx context.Context, invoiceIdentity int) (*Invoice, error) {
2510 var invoice Invoice
2511 return &invoice, s.Get(ctx, &invoice, fmt.Sprintf("/account/invoices/%v", invoiceIdentity), nil, nil)
2512 }
2513
2514 type InvoiceListResult []Invoice
2515
2516 // List existing invoices.
2517 func (s *Service) InvoiceList(ctx context.Context, lr *ListRange) (InvoiceListResult, error) {
2518 var invoice InvoiceListResult
2519 return invoice, s.Get(ctx, &invoice, fmt.Sprintf("/account/invoices"), nil, lr)
2520 }
2521
2522 // An invoice address represents the address that should be listed on an
2523 // invoice.
2524 type InvoiceAddress struct {
2525 Address1 string `json:"address_1" url:"address_1,key"` // invoice street address line 1
2526 Address2 string `json:"address_2" url:"address_2,key"` // invoice street address line 2
2527 City string `json:"city" url:"city,key"` // invoice city
2528 Country string `json:"country" url:"country,key"` // country
2529 HerokuID string `json:"heroku_id" url:"heroku_id,key"` // heroku_id identifier reference
2530 Other string `json:"other" url:"other,key"` // metadata / additional information to go on invoice
2531 PostalCode string `json:"postal_code" url:"postal_code,key"` // invoice zip code
2532 State string `json:"state" url:"state,key"` // invoice state
2533 UseInvoiceAddress bool `json:"use_invoice_address" url:"use_invoice_address,key"` // flag to use the invoice address for an account or not
2534 }
2535
2536 // Retrieve existing invoice address.
2537 func (s *Service) InvoiceAddressInfo(ctx context.Context) (*InvoiceAddress, error) {
2538 var invoiceAddress InvoiceAddress
2539 return &invoiceAddress, s.Get(ctx, &invoiceAddress, fmt.Sprintf("/account/invoice-address"), nil, nil)
2540 }
2541
2542 type InvoiceAddressUpdateOpts struct {
2543 Address1 *string `json:"address_1,omitempty" url:"address_1,omitempty,key"` // invoice street address line 1
2544 Address2 *string `json:"address_2,omitempty" url:"address_2,omitempty,key"` // invoice street address line 2
2545 City *string `json:"city,omitempty" url:"city,omitempty,key"` // invoice city
2546 Country *string `json:"country,omitempty" url:"country,omitempty,key"` // country
2547 Other *string `json:"other,omitempty" url:"other,omitempty,key"` // metadata / additional information to go on invoice
2548 PostalCode *string `json:"postal_code,omitempty" url:"postal_code,omitempty,key"` // invoice zip code
2549 State *string `json:"state,omitempty" url:"state,omitempty,key"` // invoice state
2550 UseInvoiceAddress *bool `json:"use_invoice_address,omitempty" url:"use_invoice_address,omitempty,key"` // flag to use the invoice address for an account or not
2551 }
2552
2553 // Update invoice address for an account.
2554 func (s *Service) InvoiceAddressUpdate(ctx context.Context, o InvoiceAddressUpdateOpts) (*InvoiceAddress, error) {
2555 var invoiceAddress InvoiceAddress
2556 return &invoiceAddress, s.Put(ctx, &invoiceAddress, fmt.Sprintf("/account/invoice-address"), o)
2557 }
2558
2559 // Keys represent public SSH keys associated with an account and are
2560 // used to authorize accounts as they are performing git operations.
2561 type Key struct {
2562 Comment string `json:"comment" url:"comment,key"` // comment on the key
2563 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when key was created
2564 Email string `json:"email" url:"email,key"` // deprecated. Please refer to 'comment' instead
2565 Fingerprint string `json:"fingerprint" url:"fingerprint,key"` // a unique identifying string based on contents
2566 ID string `json:"id" url:"id,key"` // unique identifier of this key
2567 PublicKey string `json:"public_key" url:"public_key,key"` // full public_key as uploaded
2568 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when key was updated
2569 }
2570
2571 // Info for existing key.
2572 func (s *Service) KeyInfo(ctx context.Context, keyIdentity string) (*Key, error) {
2573 var key Key
2574 return &key, s.Get(ctx, &key, fmt.Sprintf("/account/keys/%v", keyIdentity), nil, nil)
2575 }
2576
2577 type KeyListResult []Key
2578
2579 // List existing keys.
2580 func (s *Service) KeyList(ctx context.Context, lr *ListRange) (KeyListResult, error) {
2581 var key KeyListResult
2582 return key, s.Get(ctx, &key, fmt.Sprintf("/account/keys"), nil, lr)
2583 }
2584
2585 // [Log drains](https://devcenter.heroku.com/articles/log-drains)
2586 // provide a way to forward your Heroku logs to an external syslog
2587 // server for long-term archiving. This external service must be
2588 // configured to receive syslog packets from Heroku, whereupon its URL
2589 // can be added to an app using this API. Some add-ons will add a log
2590 // drain when they are provisioned to an app. These drains can only be
2591 // removed by removing the add-on.
2592 type LogDrain struct {
2593 Addon *struct {
2594 ID string `json:"id" url:"id,key"` // unique identifier of add-on
2595 Name string `json:"name" url:"name,key"` // globally unique name of the add-on
2596 } `json:"addon" url:"addon,key"` // add-on that created the drain
2597 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when log drain was created
2598 ID string `json:"id" url:"id,key"` // unique identifier of this log drain
2599 Token string `json:"token" url:"token,key"` // token associated with the log drain
2600 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when log drain was updated
2601 URL string `json:"url" url:"url,key"` // url associated with the log drain
2602 }
2603 type LogDrainCreateOpts struct {
2604 URL string `json:"url" url:"url,key"` // url associated with the log drain
2605 }
2606
2607 // Create a new log drain.
2608 func (s *Service) LogDrainCreate(ctx context.Context, appIdentity string, o LogDrainCreateOpts) (*LogDrain, error) {
2609 var logDrain LogDrain
2610 return &logDrain, s.Post(ctx, &logDrain, fmt.Sprintf("/apps/%v/log-drains", appIdentity), o)
2611 }
2612
2613 type LogDrainUpdateOpts struct {
2614 URL string `json:"url" url:"url,key"` // url associated with the log drain
2615 }
2616
2617 // Update an add-on owned log drain.
2618 func (s *Service) LogDrainUpdate(ctx context.Context, addOnIdentity string, logDrainQueryIdentity string, o LogDrainUpdateOpts) (*LogDrain, error) {
2619 var logDrain LogDrain
2620 return &logDrain, s.Put(ctx, &logDrain, fmt.Sprintf("/addons/%v/log-drains/%v", addOnIdentity, logDrainQueryIdentity), o)
2621 }
2622
2623 // Delete an existing log drain. Log drains added by add-ons can only be
2624 // removed by removing the add-on.
2625 func (s *Service) LogDrainDelete(ctx context.Context, appIdentity string, logDrainQueryIdentity string) (*LogDrain, error) {
2626 var logDrain LogDrain
2627 return &logDrain, s.Delete(ctx, &logDrain, fmt.Sprintf("/apps/%v/log-drains/%v", appIdentity, logDrainQueryIdentity))
2628 }
2629
2630 // Info for existing log drain.
2631 func (s *Service) LogDrainInfo(ctx context.Context, appIdentity string, logDrainQueryIdentity string) (*LogDrain, error) {
2632 var logDrain LogDrain
2633 return &logDrain, s.Get(ctx, &logDrain, fmt.Sprintf("/apps/%v/log-drains/%v", appIdentity, logDrainQueryIdentity), nil, nil)
2634 }
2635
2636 type LogDrainListByAddOnResult []LogDrain
2637
2638 // List existing log drains for an add-on.
2639 func (s *Service) LogDrainListByAddOn(ctx context.Context, addOnIdentity string, lr *ListRange) (LogDrainListByAddOnResult, error) {
2640 var logDrain LogDrainListByAddOnResult
2641 return logDrain, s.Get(ctx, &logDrain, fmt.Sprintf("/addons/%v/log-drains", addOnIdentity), nil, lr)
2642 }
2643
2644 type LogDrainListResult []LogDrain
2645
2646 // List existing log drains.
2647 func (s *Service) LogDrainList(ctx context.Context, appIdentity string, lr *ListRange) (LogDrainListResult, error) {
2648 var logDrain LogDrainListResult
2649 return logDrain, s.Get(ctx, &logDrain, fmt.Sprintf("/apps/%v/log-drains", appIdentity), nil, lr)
2650 }
2651
2652 // A log session is a reference to the http based log stream for an app.
2653 type LogSession struct {
2654 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when log connection was created
2655 ID string `json:"id" url:"id,key"` // unique identifier of this log session
2656 LogplexURL string `json:"logplex_url" url:"logplex_url,key"` // URL for log streaming session
2657 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when log session was updated
2658 }
2659 type LogSessionCreateOpts struct {
2660 Dyno *string `json:"dyno,omitempty" url:"dyno,omitempty,key"` // dyno to limit results to
2661 Lines *int `json:"lines,omitempty" url:"lines,omitempty,key"` // number of log lines to stream at once
2662 Source *string `json:"source,omitempty" url:"source,omitempty,key"` // log source to limit results to
2663 Tail *bool `json:"tail,omitempty" url:"tail,omitempty,key"` // whether to stream ongoing logs
2664 }
2665
2666 // Create a new log session.
2667 func (s *Service) LogSessionCreate(ctx context.Context, appIdentity string, o LogSessionCreateOpts) (*LogSession, error) {
2668 var logSession LogSession
2669 return &logSession, s.Post(ctx, &logSession, fmt.Sprintf("/apps/%v/log-sessions", appIdentity), o)
2670 }
2671
2672 // OAuth authorizations represent clients that a Heroku user has
2673 // authorized to automate, customize or extend their usage of the
2674 // platform. For more information please refer to the [Heroku OAuth
2675 // documentation](https://devcenter.heroku.com/articles/oauth)
2676 type OAuthAuthorization struct {
2677 AccessToken *struct {
2678 ExpiresIn *int `json:"expires_in" url:"expires_in,key"` // seconds until OAuth token expires; may be `null` for tokens with
2679 // indefinite lifetime
2680 ID string `json:"id" url:"id,key"` // unique identifier of OAuth token
2681 Token string `json:"token" url:"token,key"` // contents of the token to be used for authorization
2682 } `json:"access_token" url:"access_token,key"` // access token for this authorization
2683 Client *struct {
2684 ID string `json:"id" url:"id,key"` // unique identifier of this OAuth client
2685 Name string `json:"name" url:"name,key"` // OAuth client name
2686 RedirectURI string `json:"redirect_uri" url:"redirect_uri,key"` // endpoint for redirection after authorization with OAuth client
2687 } `json:"client" url:"client,key"` // identifier of the client that obtained this authorization, if any
2688 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when OAuth authorization was created
2689 Grant *struct {
2690 Code string `json:"code" url:"code,key"` // grant code received from OAuth web application authorization
2691 ExpiresIn int `json:"expires_in" url:"expires_in,key"` // seconds until OAuth grant expires
2692 ID string `json:"id" url:"id,key"` // unique identifier of OAuth grant
2693 } `json:"grant" url:"grant,key"` // this authorization's grant
2694 ID string `json:"id" url:"id,key"` // unique identifier of OAuth authorization
2695 RefreshToken *struct {
2696 ExpiresIn *int `json:"expires_in" url:"expires_in,key"` // seconds until OAuth token expires; may be `null` for tokens with
2697 // indefinite lifetime
2698 ID string `json:"id" url:"id,key"` // unique identifier of OAuth token
2699 Token string `json:"token" url:"token,key"` // contents of the token to be used for authorization
2700 } `json:"refresh_token" url:"refresh_token,key"` // refresh token for this authorization
2701 Scope []string `json:"scope" url:"scope,key"` // The scope of access OAuth authorization allows
2702 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when OAuth authorization was updated
2703 User struct {
2704 Email string `json:"email" url:"email,key"` // unique email address of account
2705 FullName *string `json:"full_name" url:"full_name,key"` // full name of the account owner
2706 ID string `json:"id" url:"id,key"` // unique identifier of an account
2707 } `json:"user" url:"user,key"` // authenticated user associated with this authorization
2708 }
2709 type OAuthAuthorizationCreateOpts struct {
2710 Client *string `json:"client,omitempty" url:"client,omitempty,key"` // unique identifier of this OAuth client
2711 Description *string `json:"description,omitempty" url:"description,omitempty,key"` // human-friendly description of this OAuth authorization
2712 ExpiresIn *int `json:"expires_in,omitempty" url:"expires_in,omitempty,key"` // seconds until OAuth token expires; may be `null` for tokens with
2713 // indefinite lifetime
2714 Scope []string `json:"scope" url:"scope,key"` // The scope of access OAuth authorization allows
2715 }
2716
2717 // Create a new OAuth authorization.
2718 func (s *Service) OAuthAuthorizationCreate(ctx context.Context, o OAuthAuthorizationCreateOpts) (*OAuthAuthorization, error) {
2719 var oauthAuthorization OAuthAuthorization
2720 return &oauthAuthorization, s.Post(ctx, &oauthAuthorization, fmt.Sprintf("/oauth/authorizations"), o)
2721 }
2722
2723 // Delete OAuth authorization.
2724 func (s *Service) OAuthAuthorizationDelete(ctx context.Context, oauthAuthorizationIdentity string) (*OAuthAuthorization, error) {
2725 var oauthAuthorization OAuthAuthorization
2726 return &oauthAuthorization, s.Delete(ctx, &oauthAuthorization, fmt.Sprintf("/oauth/authorizations/%v", oauthAuthorizationIdentity))
2727 }
2728
2729 // Info for an OAuth authorization.
2730 func (s *Service) OAuthAuthorizationInfo(ctx context.Context, oauthAuthorizationIdentity string) (*OAuthAuthorization, error) {
2731 var oauthAuthorization OAuthAuthorization
2732 return &oauthAuthorization, s.Get(ctx, &oauthAuthorization, fmt.Sprintf("/oauth/authorizations/%v", oauthAuthorizationIdentity), nil, nil)
2733 }
2734
2735 type OAuthAuthorizationListResult []OAuthAuthorization
2736
2737 // List OAuth authorizations.
2738 func (s *Service) OAuthAuthorizationList(ctx context.Context, lr *ListRange) (OAuthAuthorizationListResult, error) {
2739 var oauthAuthorization OAuthAuthorizationListResult
2740 return oauthAuthorization, s.Get(ctx, &oauthAuthorization, fmt.Sprintf("/oauth/authorizations"), nil, lr)
2741 }
2742
2743 // Regenerate OAuth tokens. This endpoint is only available to direct
2744 // authorizations or privileged OAuth clients.
2745 func (s *Service) OAuthAuthorizationRegenerate(ctx context.Context, oauthAuthorizationIdentity string) (*OAuthAuthorization, error) {
2746 var oauthAuthorization OAuthAuthorization
2747 return &oauthAuthorization, s.Post(ctx, &oauthAuthorization, fmt.Sprintf("/oauth/authorizations/%v/actions/regenerate-tokens", oauthAuthorizationIdentity), nil)
2748 }
2749
2750 // OAuth clients are applications that Heroku users can authorize to
2751 // automate, customize or extend their usage of the platform. For more
2752 // information please refer to the [Heroku OAuth
2753 // documentation](https://devcenter.heroku.com/articles/oauth).
2754 type OAuthClient struct {
2755 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when OAuth client was created
2756 ID string `json:"id" url:"id,key"` // unique identifier of this OAuth client
2757 IgnoresDelinquent *bool `json:"ignores_delinquent" url:"ignores_delinquent,key"` // whether the client is still operable given a delinquent account
2758 Name string `json:"name" url:"name,key"` // OAuth client name
2759 RedirectURI string `json:"redirect_uri" url:"redirect_uri,key"` // endpoint for redirection after authorization with OAuth client
2760 Secret string `json:"secret" url:"secret,key"` // secret used to obtain OAuth authorizations under this client
2761 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when OAuth client was updated
2762 }
2763 type OAuthClientCreateOpts struct {
2764 Name string `json:"name" url:"name,key"` // OAuth client name
2765 RedirectURI string `json:"redirect_uri" url:"redirect_uri,key"` // endpoint for redirection after authorization with OAuth client
2766 }
2767
2768 // Create a new OAuth client.
2769 func (s *Service) OAuthClientCreate(ctx context.Context, o OAuthClientCreateOpts) (*OAuthClient, error) {
2770 var oauthClient OAuthClient
2771 return &oauthClient, s.Post(ctx, &oauthClient, fmt.Sprintf("/oauth/clients"), o)
2772 }
2773
2774 // Delete OAuth client.
2775 func (s *Service) OAuthClientDelete(ctx context.Context, oauthClientIdentity string) (*OAuthClient, error) {
2776 var oauthClient OAuthClient
2777 return &oauthClient, s.Delete(ctx, &oauthClient, fmt.Sprintf("/oauth/clients/%v", oauthClientIdentity))
2778 }
2779
2780 // Info for an OAuth client
2781 func (s *Service) OAuthClientInfo(ctx context.Context, oauthClientIdentity string) (*OAuthClient, error) {
2782 var oauthClient OAuthClient
2783 return &oauthClient, s.Get(ctx, &oauthClient, fmt.Sprintf("/oauth/clients/%v", oauthClientIdentity), nil, nil)
2784 }
2785
2786 type OAuthClientListResult []OAuthClient
2787
2788 // List OAuth clients
2789 func (s *Service) OAuthClientList(ctx context.Context, lr *ListRange) (OAuthClientListResult, error) {
2790 var oauthClient OAuthClientListResult
2791 return oauthClient, s.Get(ctx, &oauthClient, fmt.Sprintf("/oauth/clients"), nil, lr)
2792 }
2793
2794 type OAuthClientUpdateOpts struct {
2795 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // OAuth client name
2796 RedirectURI *string `json:"redirect_uri,omitempty" url:"redirect_uri,omitempty,key"` // endpoint for redirection after authorization with OAuth client
2797 }
2798
2799 // Update OAuth client
2800 func (s *Service) OAuthClientUpdate(ctx context.Context, oauthClientIdentity string, o OAuthClientUpdateOpts) (*OAuthClient, error) {
2801 var oauthClient OAuthClient
2802 return &oauthClient, s.Patch(ctx, &oauthClient, fmt.Sprintf("/oauth/clients/%v", oauthClientIdentity), o)
2803 }
2804
2805 // Rotate credentials for an OAuth client
2806 func (s *Service) OAuthClientRotateCredentials(ctx context.Context, oauthClientIdentity string) (*OAuthClient, error) {
2807 var oauthClient OAuthClient
2808 return &oauthClient, s.Post(ctx, &oauthClient, fmt.Sprintf("/oauth/clients/%v/actions/rotate-credentials", oauthClientIdentity), nil)
2809 }
2810
2811 // OAuth grants are used to obtain authorizations on behalf of a user.
2812 // For more information please refer to the [Heroku OAuth
2813 // documentation](https://devcenter.heroku.com/articles/oauth)
2814 type OAuthGrant struct{}
2815
2816 // OAuth tokens provide access for authorized clients to act on behalf
2817 // of a Heroku user to automate, customize or extend their usage of the
2818 // platform. For more information please refer to the [Heroku OAuth
2819 // documentation](https://devcenter.heroku.com/articles/oauth)
2820 type OAuthToken struct {
2821 AccessToken struct {
2822 ExpiresIn *int `json:"expires_in" url:"expires_in,key"` // seconds until OAuth token expires; may be `null` for tokens with
2823 // indefinite lifetime
2824 ID string `json:"id" url:"id,key"` // unique identifier of OAuth token
2825 Token string `json:"token" url:"token,key"` // contents of the token to be used for authorization
2826 } `json:"access_token" url:"access_token,key"` // current access token
2827 Authorization struct {
2828 ID string `json:"id" url:"id,key"` // unique identifier of OAuth authorization
2829 } `json:"authorization" url:"authorization,key"` // authorization for this set of tokens
2830 Client *struct {
2831 Secret string `json:"secret" url:"secret,key"` // secret used to obtain OAuth authorizations under this client
2832 } `json:"client" url:"client,key"` // OAuth client secret used to obtain token
2833 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when OAuth token was created
2834 Grant struct {
2835 Code string `json:"code" url:"code,key"` // grant code received from OAuth web application authorization
2836 Type string `json:"type" url:"type,key"` // type of grant requested, one of `authorization_code` or
2837 // `refresh_token`
2838 } `json:"grant" url:"grant,key"` // grant used on the underlying authorization
2839 ID string `json:"id" url:"id,key"` // unique identifier of OAuth token
2840 RefreshToken struct {
2841 ExpiresIn *int `json:"expires_in" url:"expires_in,key"` // seconds until OAuth token expires; may be `null` for tokens with
2842 // indefinite lifetime
2843 ID string `json:"id" url:"id,key"` // unique identifier of OAuth token
2844 Token string `json:"token" url:"token,key"` // contents of the token to be used for authorization
2845 } `json:"refresh_token" url:"refresh_token,key"` // refresh token for this authorization
2846 Session struct {
2847 ID string `json:"id" url:"id,key"` // unique identifier of OAuth token
2848 } `json:"session" url:"session,key"` // OAuth session using this token
2849 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when OAuth token was updated
2850 User struct {
2851 ID string `json:"id" url:"id,key"` // unique identifier of an account
2852 } `json:"user" url:"user,key"` // Reference to the user associated with this token
2853 }
2854 type OAuthTokenCreateOpts struct {
2855 Client struct {
2856 Secret *string `json:"secret,omitempty" url:"secret,omitempty,key"` // secret used to obtain OAuth authorizations under this client
2857 } `json:"client" url:"client,key"`
2858 Grant struct {
2859 Code *string `json:"code,omitempty" url:"code,omitempty,key"` // grant code received from OAuth web application authorization
2860 Type *string `json:"type,omitempty" url:"type,omitempty,key"` // type of grant requested, one of `authorization_code` or
2861 // `refresh_token`
2862 } `json:"grant" url:"grant,key"`
2863 RefreshToken struct {
2864 Token *string `json:"token,omitempty" url:"token,omitempty,key"` // contents of the token to be used for authorization
2865 } `json:"refresh_token" url:"refresh_token,key"`
2866 }
2867
2868 // Create a new OAuth token.
2869 func (s *Service) OAuthTokenCreate(ctx context.Context, o OAuthTokenCreateOpts) (*OAuthToken, error) {
2870 var oauthToken OAuthToken
2871 return &oauthToken, s.Post(ctx, &oauthToken, fmt.Sprintf("/oauth/tokens"), o)
2872 }
2873
2874 // Revoke OAuth access token.
2875 func (s *Service) OAuthTokenDelete(ctx context.Context, oauthTokenIdentity string) (*OAuthToken, error) {
2876 var oauthToken OAuthToken
2877 return &oauthToken, s.Delete(ctx, &oauthToken, fmt.Sprintf("/oauth/tokens/%v", oauthTokenIdentity))
2878 }
2879
2880 // An outbound-ruleset is a collection of rules that specify what hosts
2881 // Dynos are allowed to communicate with.
2882 type OutboundRuleset struct {
2883 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when outbound-ruleset was created
2884 CreatedBy string `json:"created_by" url:"created_by,key"` // unique email address of account
2885 ID string `json:"id" url:"id,key"` // unique identifier of an outbound-ruleset
2886 Rules []struct {
2887 FromPort int `json:"from_port" url:"from_port,key"` // an endpoint of communication in an operating system.
2888 Protocol string `json:"protocol" url:"protocol,key"` // formal standards and policies comprised of rules, procedures and
2889 // formats that define communication between two or more devices over a
2890 // network
2891 Target string `json:"target" url:"target,key"` // is the target destination in CIDR notation
2892 ToPort int `json:"to_port" url:"to_port,key"` // an endpoint of communication in an operating system.
2893 } `json:"rules" url:"rules,key"`
2894 Space struct {
2895 ID string `json:"id" url:"id,key"` // unique identifier of space
2896 Name string `json:"name" url:"name,key"` // unique name of space
2897 } `json:"space" url:"space,key"` // identity of space
2898 }
2899
2900 // Current outbound ruleset for a space
2901 func (s *Service) OutboundRulesetCurrent(ctx context.Context, spaceIdentity string) (*OutboundRuleset, error) {
2902 var outboundRuleset OutboundRuleset
2903 return &outboundRuleset, s.Get(ctx, &outboundRuleset, fmt.Sprintf("/spaces/%v/outbound-ruleset", spaceIdentity), nil, nil)
2904 }
2905
2906 // Info on an existing Outbound Ruleset
2907 func (s *Service) OutboundRulesetInfo(ctx context.Context, spaceIdentity string, outboundRulesetIdentity string) (*OutboundRuleset, error) {
2908 var outboundRuleset OutboundRuleset
2909 return &outboundRuleset, s.Get(ctx, &outboundRuleset, fmt.Sprintf("/spaces/%v/outbound-rulesets/%v", spaceIdentity, outboundRulesetIdentity), nil, nil)
2910 }
2911
2912 type OutboundRulesetListResult []OutboundRuleset
2913
2914 // List all Outbound Rulesets for a space
2915 func (s *Service) OutboundRulesetList(ctx context.Context, spaceIdentity string, lr *ListRange) (OutboundRulesetListResult, error) {
2916 var outboundRuleset OutboundRulesetListResult
2917 return outboundRuleset, s.Get(ctx, &outboundRuleset, fmt.Sprintf("/spaces/%v/outbound-rulesets", spaceIdentity), nil, lr)
2918 }
2919
2920 type OutboundRulesetCreateOpts struct {
2921 Rules []*struct {
2922 FromPort int `json:"from_port" url:"from_port,key"` // an endpoint of communication in an operating system.
2923 Protocol string `json:"protocol" url:"protocol,key"` // formal standards and policies comprised of rules, procedures and
2924 // formats that define communication between two or more devices over a
2925 // network
2926 Target string `json:"target" url:"target,key"` // is the target destination in CIDR notation
2927 ToPort int `json:"to_port" url:"to_port,key"` // an endpoint of communication in an operating system.
2928 } `json:"rules,omitempty" url:"rules,omitempty,key"`
2929 }
2930
2931 // Create a new outbound ruleset
2932 func (s *Service) OutboundRulesetCreate(ctx context.Context, spaceIdentity string, o OutboundRulesetCreateOpts) (*OutboundRuleset, error) {
2933 var outboundRuleset OutboundRuleset
2934 return &outboundRuleset, s.Put(ctx, &outboundRuleset, fmt.Sprintf("/spaces/%v/outbound-ruleset", spaceIdentity), o)
2935 }
2936
2937 // A password reset represents a in-process password reset attempt.
2938 type PasswordReset struct {
2939 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when password reset was created
2940 User struct {
2941 Email string `json:"email" url:"email,key"` // unique email address of account
2942 ID string `json:"id" url:"id,key"` // unique identifier of an account
2943 } `json:"user" url:"user,key"`
2944 }
2945 type PasswordResetResetPasswordOpts struct {
2946 Email *string `json:"email,omitempty" url:"email,omitempty,key"` // unique email address of account
2947 }
2948
2949 // Reset account's password. This will send a reset password link to the
2950 // user's email address.
2951 func (s *Service) PasswordResetResetPassword(ctx context.Context, o PasswordResetResetPasswordOpts) (*PasswordReset, error) {
2952 var passwordReset PasswordReset
2953 return &passwordReset, s.Post(ctx, &passwordReset, fmt.Sprintf("/password-resets"), o)
2954 }
2955
2956 type PasswordResetCompleteResetPasswordOpts struct {
2957 Password *string `json:"password,omitempty" url:"password,omitempty,key"` // current password on the account
2958 PasswordConfirmation *string `json:"password_confirmation,omitempty" url:"password_confirmation,omitempty,key"` // confirmation of the new password
2959 }
2960
2961 // Complete password reset.
2962 func (s *Service) PasswordResetCompleteResetPassword(ctx context.Context, passwordResetResetPasswordToken string, o PasswordResetCompleteResetPasswordOpts) (*PasswordReset, error) {
2963 var passwordReset PasswordReset
2964 return &passwordReset, s.Post(ctx, &passwordReset, fmt.Sprintf("/password-resets/%v/actions/finalize", passwordResetResetPasswordToken), o)
2965 }
2966
2967 // [Peering](https://devcenter.heroku.com/articles/private-space-peering)
2968 // provides a way to peer your Private Space VPC to another AWS VPC.
2969 type Peering struct {
2970 AwsAccountID string `json:"aws_account_id" url:"aws_account_id,key"` // The AWS account ID of your Private Space.
2971 AwsRegion string `json:"aws_region" url:"aws_region,key"` // The AWS region of the peer connection.
2972 AwsVpcID string `json:"aws_vpc_id" url:"aws_vpc_id,key"` // The AWS VPC ID of the peer.
2973 CIDRBlocks []string `json:"cidr_blocks" url:"cidr_blocks,key"` // The CIDR blocks of the peer.
2974 Expires time.Time `json:"expires" url:"expires,key"` // When a peering connection will expire.
2975 PcxID string `json:"pcx_id" url:"pcx_id,key"` // The AWS VPC Peering Connection ID of the peering.
2976 Status string `json:"status" url:"status,key"` // The status of the peering connection.
2977 Type string `json:"type" url:"type,key"` // The type of peering connection.
2978 }
2979 type PeeringListResult []Peering
2980
2981 // List peering connections of a private space.
2982 func (s *Service) PeeringList(ctx context.Context, spaceIdentity string, lr *ListRange) (PeeringListResult, error) {
2983 var peering PeeringListResult
2984 return peering, s.Get(ctx, &peering, fmt.Sprintf("/spaces/%v/peerings", spaceIdentity), nil, lr)
2985 }
2986
2987 // Accept a pending peering connection with a private space.
2988 func (s *Service) PeeringAccept(ctx context.Context, spaceIdentity string, peeringPcxID string) (*Peering, error) {
2989 var peering Peering
2990 return &peering, s.Post(ctx, &peering, fmt.Sprintf("/spaces/%v/peerings/%v/actions/accept", spaceIdentity, peeringPcxID), nil)
2991 }
2992
2993 // Destroy an active peering connection with a private space.
2994 func (s *Service) PeeringDestroy(ctx context.Context, spaceIdentity string, peeringPcxID string) (*Peering, error) {
2995 var peering Peering
2996 return &peering, s.Delete(ctx, &peering, fmt.Sprintf("/spaces/%v/peerings/%v", spaceIdentity, peeringPcxID))
2997 }
2998
2999 // Fetch information for existing peering connection
3000 func (s *Service) PeeringInfo(ctx context.Context, spaceIdentity string, peeringPcxID string) (*Peering, error) {
3001 var peering Peering
3002 return &peering, s.Get(ctx, &peering, fmt.Sprintf("/spaces/%v/peerings/%v", spaceIdentity, peeringPcxID), nil, nil)
3003 }
3004
3005 // [Peering
3006 // Info](https://devcenter.heroku.com/articles/private-space-peering)
3007 // gives you the information necessary to peer an AWS VPC to a Private
3008 // Space.
3009 type PeeringInfo struct {
3010 AwsAccountID string `json:"aws_account_id" url:"aws_account_id,key"` // The AWS account ID of your Private Space.
3011 AwsRegion string `json:"aws_region" url:"aws_region,key"` // region name used by provider
3012 DynoCIDRBlocks []string `json:"dyno_cidr_blocks" url:"dyno_cidr_blocks,key"` // The CIDR ranges that should be routed to the Private Space VPC.
3013 SpaceCIDRBlocks []string `json:"space_cidr_blocks" url:"space_cidr_blocks,key"` // The CIDR ranges that should be routed to the Private Space VPC.
3014 UnavailableCIDRBlocks []string `json:"unavailable_cidr_blocks" url:"unavailable_cidr_blocks,key"` // The CIDR ranges that you must not conflict with.
3015 VpcCIDR string `json:"vpc_cidr" url:"vpc_cidr,key"` // An IP address and the number of significant bits that make up the
3016 // routing or networking portion.
3017 VpcID string `json:"vpc_id" url:"vpc_id,key"` // The AWS VPC ID of the peer.
3018 }
3019
3020 // Provides the necessary information to establish an AWS VPC Peering
3021 // with your private space.
3022 func (s *Service) PeeringInfoInfo(ctx context.Context, spaceIdentity string) (*PeeringInfo, error) {
3023 var peeringInfo PeeringInfo
3024 return &peeringInfo, s.Get(ctx, &peeringInfo, fmt.Sprintf("/spaces/%v/peering-info", spaceIdentity), nil, nil)
3025 }
3026
3027 // An owned entity including users' permissions.
3028 type PermissionEntity struct {
3029 ID string `json:"id" url:"id,key"` // ID of the entity.
3030 Name string `json:"name" url:"name,key"` // Name of the entity.
3031 TeamID string `json:"team_id" url:"team_id,key"` // unique identifier of team
3032 Type string `json:"type" url:"type,key"` // The type of object the entity is referring to.
3033 Users []struct {
3034 Email string `json:"email" url:"email,key"` // unique email address of account
3035 ID string `json:"id" url:"id,key"` // unique identifier of an account
3036 Permissions []string `json:"permissions" url:"permissions,key"` // enterprise account permissions
3037 } `json:"users" url:"users,key"` // Users that have access to the entity.
3038 }
3039 type PermissionEntityListResult []PermissionEntity
3040
3041 // List permission entities for a team.
3042 func (s *Service) PermissionEntityList(ctx context.Context, teamIdentity string, lr *ListRange) (PermissionEntityListResult, error) {
3043 var permissionEntity PermissionEntityListResult
3044 return permissionEntity, s.Get(ctx, &permissionEntity, fmt.Sprintf("/teams/%v/permissions", teamIdentity), nil, lr)
3045 }
3046
3047 // A pipeline allows grouping of apps into different stages.
3048 type Pipeline struct {
3049 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when pipeline was created
3050 ID string `json:"id" url:"id,key"` // unique identifier of pipeline
3051 Name string `json:"name" url:"name,key"` // name of pipeline
3052 Owner *struct {
3053 ID string `json:"id" url:"id,key"` // unique identifier of a pipeline owner
3054 Type string `json:"type" url:"type,key"` // type of pipeline owner
3055 } `json:"owner" url:"owner,key"` // Owner of a pipeline.
3056 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when pipeline was updated
3057 }
3058 type PipelineCreateOpts struct {
3059 Name string `json:"name" url:"name,key"` // name of pipeline
3060 Owner *struct {
3061 ID string `json:"id" url:"id,key"` // unique identifier of a pipeline owner
3062 Type string `json:"type" url:"type,key"` // type of pipeline owner
3063 } `json:"owner,omitempty" url:"owner,omitempty,key"` // Owner of a pipeline.
3064 }
3065
3066 // Create a new pipeline.
3067 func (s *Service) PipelineCreate(ctx context.Context, o PipelineCreateOpts) (*Pipeline, error) {
3068 var pipeline Pipeline
3069 return &pipeline, s.Post(ctx, &pipeline, fmt.Sprintf("/pipelines"), o)
3070 }
3071
3072 // Info for existing pipeline.
3073 func (s *Service) PipelineInfo(ctx context.Context, pipelineIdentity string) (*Pipeline, error) {
3074 var pipeline Pipeline
3075 return &pipeline, s.Get(ctx, &pipeline, fmt.Sprintf("/pipelines/%v", pipelineIdentity), nil, nil)
3076 }
3077
3078 // Delete an existing pipeline.
3079 func (s *Service) PipelineDelete(ctx context.Context, pipelineID string) (*Pipeline, error) {
3080 var pipeline Pipeline
3081 return &pipeline, s.Delete(ctx, &pipeline, fmt.Sprintf("/pipelines/%v", pipelineID))
3082 }
3083
3084 type PipelineUpdateOpts struct {
3085 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // name of pipeline
3086 }
3087
3088 // Update an existing pipeline.
3089 func (s *Service) PipelineUpdate(ctx context.Context, pipelineID string, o PipelineUpdateOpts) (*Pipeline, error) {
3090 var pipeline Pipeline
3091 return &pipeline, s.Patch(ctx, &pipeline, fmt.Sprintf("/pipelines/%v", pipelineID), o)
3092 }
3093
3094 type PipelineListResult []Pipeline
3095
3096 // List existing pipelines.
3097 func (s *Service) PipelineList(ctx context.Context, lr *ListRange) (PipelineListResult, error) {
3098 var pipeline PipelineListResult
3099 return pipeline, s.Get(ctx, &pipeline, fmt.Sprintf("/pipelines"), nil, lr)
3100 }
3101
3102 // Information about latest builds of apps in a pipeline.
3103 type PipelineBuild struct{}
3104 type PipelineBuildListResult []struct {
3105 App struct {
3106 ID string `json:"id" url:"id,key"` // unique identifier of app
3107 } `json:"app" url:"app,key"` // app that the build belongs to
3108 Buildpacks []struct {
3109 Name string `json:"name" url:"name,key"` // Buildpack Registry name of the buildpack for the app
3110 URL string `json:"url" url:"url,key"` // the URL of the buildpack for the app
3111 } `json:"buildpacks" url:"buildpacks,key"` // buildpacks executed for this build, in order
3112 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when build was created
3113 ID string `json:"id" url:"id,key"` // unique identifier of build
3114 OutputStreamURL string `json:"output_stream_url" url:"output_stream_url,key"` // Build process output will be available from this URL as a stream. The
3115 // stream is available as either `text/plain` or `text/event-stream`.
3116 // Clients should be prepared to handle disconnects and can resume the
3117 // stream by sending a `Range` header (for `text/plain`) or a
3118 // `Last-Event-Id` header (for `text/event-stream`).
3119 Release *struct {
3120 ID string `json:"id" url:"id,key"` // unique identifier of release
3121 } `json:"release" url:"release,key"` // release resulting from the build
3122 Slug *struct {
3123 ID string `json:"id" url:"id,key"` // unique identifier of slug
3124 } `json:"slug" url:"slug,key"` // slug created by this build
3125 SourceBlob struct {
3126 Checksum *string `json:"checksum" url:"checksum,key"` // an optional checksum of the gzipped tarball for verifying its
3127 // integrity
3128 URL string `json:"url" url:"url,key"` // URL where gzipped tar archive of source code for build was
3129 // downloaded.
3130 Version *string `json:"version" url:"version,key"` // Version of the gzipped tarball.
3131 } `json:"source_blob" url:"source_blob,key"` // location of gzipped tarball of source code used to create build
3132 Stack string `json:"stack" url:"stack,key"` // stack of build
3133 Status string `json:"status" url:"status,key"` // status of build
3134 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when build was updated
3135 User struct {
3136 Email string `json:"email" url:"email,key"` // unique email address of account
3137 ID string `json:"id" url:"id,key"` // unique identifier of an account
3138 } `json:"user" url:"user,key"` // user that started the build
3139 }
3140
3141 // List latest builds for each app in a pipeline
3142 func (s *Service) PipelineBuildList(ctx context.Context, pipelineID string, lr *ListRange) (PipelineBuildListResult, error) {
3143 var pipelineBuild PipelineBuildListResult
3144 return pipelineBuild, s.Get(ctx, &pipelineBuild, fmt.Sprintf("/pipelines/%v/latest-builds", pipelineID), nil, lr)
3145 }
3146
3147 // Pipeline Config Vars allow you to manage the configuration
3148 // information provided to a pipeline.
3149 type PipelineConfigVar map[string]string
3150 type PipelineConfigVarInfoForAppResult map[string]*string
3151
3152 // Get config-vars for a pipeline stage.
3153 func (s *Service) PipelineConfigVarInfoForApp(ctx context.Context, pipelineID string, pipelineCouplingStage string) (PipelineConfigVarInfoForAppResult, error) {
3154 var pipelineConfigVar PipelineConfigVarInfoForAppResult
3155 return pipelineConfigVar, s.Get(ctx, &pipelineConfigVar, fmt.Sprintf("/pipelines/%v/stage/%v/config-vars", pipelineID, pipelineCouplingStage), nil, nil)
3156 }
3157
3158 type PipelineConfigVarUpdateResult map[string]*string
3159
3160 // Update config-vars for a pipeline stage. You can update existing
3161 // config-vars by setting them again, and remove by setting it to
3162 // `null`.
3163 func (s *Service) PipelineConfigVarUpdate(ctx context.Context, pipelineID string, pipelineCouplingStage string, o map[string]*string) (PipelineConfigVarUpdateResult, error) {
3164 var pipelineConfigVar PipelineConfigVarUpdateResult
3165 return pipelineConfigVar, s.Patch(ctx, &pipelineConfigVar, fmt.Sprintf("/pipelines/%v/stage/%v/config-vars", pipelineID, pipelineCouplingStage), o)
3166 }
3167
3168 // Information about an app's coupling to a pipeline
3169 type PipelineCoupling struct {
3170 App struct {
3171 ID string `json:"id" url:"id,key"` // unique identifier of app
3172 } `json:"app" url:"app,key"` // app involved in the pipeline coupling
3173 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when pipeline coupling was created
3174 ID string `json:"id" url:"id,key"` // unique identifier of pipeline coupling
3175 Pipeline struct {
3176 ID string `json:"id" url:"id,key"` // unique identifier of pipeline
3177 } `json:"pipeline" url:"pipeline,key"` // pipeline involved in the coupling
3178 Stage string `json:"stage" url:"stage,key"` // target pipeline stage
3179 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when pipeline coupling was updated
3180 }
3181 type PipelineCouplingListByPipelineResult []PipelineCoupling
3182
3183 // List couplings for a pipeline
3184 func (s *Service) PipelineCouplingListByPipeline(ctx context.Context, pipelineID string, lr *ListRange) (PipelineCouplingListByPipelineResult, error) {
3185 var pipelineCoupling PipelineCouplingListByPipelineResult
3186 return pipelineCoupling, s.Get(ctx, &pipelineCoupling, fmt.Sprintf("/pipelines/%v/pipeline-couplings", pipelineID), nil, lr)
3187 }
3188
3189 type PipelineCouplingListByCurrentUserResult []PipelineCoupling
3190
3191 // List pipeline couplings for the current user.
3192 func (s *Service) PipelineCouplingListByCurrentUser(ctx context.Context, lr *ListRange) (PipelineCouplingListByCurrentUserResult, error) {
3193 var pipelineCoupling PipelineCouplingListByCurrentUserResult
3194 return pipelineCoupling, s.Get(ctx, &pipelineCoupling, fmt.Sprintf("/users/~/pipeline-couplings"), nil, lr)
3195 }
3196
3197 type PipelineCouplingListResult []PipelineCoupling
3198
3199 // List pipeline couplings.
3200 func (s *Service) PipelineCouplingList(ctx context.Context, lr *ListRange) (PipelineCouplingListResult, error) {
3201 var pipelineCoupling PipelineCouplingListResult
3202 return pipelineCoupling, s.Get(ctx, &pipelineCoupling, fmt.Sprintf("/pipeline-couplings"), nil, lr)
3203 }
3204
3205 type PipelineCouplingListByTeamResult []PipelineCoupling
3206
3207 // List pipeline couplings for a team.
3208 func (s *Service) PipelineCouplingListByTeam(ctx context.Context, teamIdentity string, lr *ListRange) (PipelineCouplingListByTeamResult, error) {
3209 var pipelineCoupling PipelineCouplingListByTeamResult
3210 return pipelineCoupling, s.Get(ctx, &pipelineCoupling, fmt.Sprintf("/teams/%v/pipeline-couplings", teamIdentity), nil, lr)
3211 }
3212
3213 type PipelineCouplingCreateOpts struct {
3214 App string `json:"app" url:"app,key"` // unique identifier of app
3215 Pipeline string `json:"pipeline" url:"pipeline,key"` // unique identifier of pipeline
3216 Stage string `json:"stage" url:"stage,key"` // target pipeline stage
3217 }
3218
3219 // Create a new pipeline coupling.
3220 func (s *Service) PipelineCouplingCreate(ctx context.Context, o PipelineCouplingCreateOpts) (*PipelineCoupling, error) {
3221 var pipelineCoupling PipelineCoupling
3222 return &pipelineCoupling, s.Post(ctx, &pipelineCoupling, fmt.Sprintf("/pipeline-couplings"), o)
3223 }
3224
3225 // Info for an existing pipeline coupling.
3226 func (s *Service) PipelineCouplingInfo(ctx context.Context, pipelineCouplingIdentity string) (*PipelineCoupling, error) {
3227 var pipelineCoupling PipelineCoupling
3228 return &pipelineCoupling, s.Get(ctx, &pipelineCoupling, fmt.Sprintf("/pipeline-couplings/%v", pipelineCouplingIdentity), nil, nil)
3229 }
3230
3231 // Delete an existing pipeline coupling.
3232 func (s *Service) PipelineCouplingDelete(ctx context.Context, pipelineCouplingIdentity string) (*PipelineCoupling, error) {
3233 var pipelineCoupling PipelineCoupling
3234 return &pipelineCoupling, s.Delete(ctx, &pipelineCoupling, fmt.Sprintf("/pipeline-couplings/%v", pipelineCouplingIdentity))
3235 }
3236
3237 type PipelineCouplingUpdateOpts struct {
3238 Stage *string `json:"stage,omitempty" url:"stage,omitempty,key"` // target pipeline stage
3239 }
3240
3241 // Update an existing pipeline coupling.
3242 func (s *Service) PipelineCouplingUpdate(ctx context.Context, pipelineCouplingIdentity string, o PipelineCouplingUpdateOpts) (*PipelineCoupling, error) {
3243 var pipelineCoupling PipelineCoupling
3244 return &pipelineCoupling, s.Patch(ctx, &pipelineCoupling, fmt.Sprintf("/pipeline-couplings/%v", pipelineCouplingIdentity), o)
3245 }
3246
3247 // Info for an existing pipeline coupling.
3248 func (s *Service) PipelineCouplingInfoByApp(ctx context.Context, appIdentity string) (*PipelineCoupling, error) {
3249 var pipelineCoupling PipelineCoupling
3250 return &pipelineCoupling, s.Get(ctx, &pipelineCoupling, fmt.Sprintf("/apps/%v/pipeline-couplings", appIdentity), nil, nil)
3251 }
3252
3253 // Information about latest deployments of apps in a pipeline.
3254 type PipelineDeployment struct{}
3255 type PipelineDeploymentListResult []struct {
3256 AddonPlanNames []string `json:"addon_plan_names" url:"addon_plan_names,key"` // add-on plans installed on the app for this release
3257 App struct {
3258 ID string `json:"id" url:"id,key"` // unique identifier of app
3259 Name string `json:"name" url:"name,key"` // unique name of app
3260 } `json:"app" url:"app,key"` // app involved in the release
3261 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when release was created
3262 Current bool `json:"current" url:"current,key"` // indicates this release as being the current one for the app
3263 Description string `json:"description" url:"description,key"` // description of changes in this release
3264 ID string `json:"id" url:"id,key"` // unique identifier of release
3265 OutputStreamURL *string `json:"output_stream_url" url:"output_stream_url,key"` // Release command output will be available from this URL as a stream.
3266 // The stream is available as either `text/plain` or
3267 // `text/event-stream`. Clients should be prepared to handle disconnects
3268 // and can resume the stream by sending a `Range` header (for
3269 // `text/plain`) or a `Last-Event-Id` header (for `text/event-stream`).
3270 Slug *struct {
3271 ID string `json:"id" url:"id,key"` // unique identifier of slug
3272 } `json:"slug" url:"slug,key"` // slug running in this release
3273 Status string `json:"status" url:"status,key"` // current status of the release
3274 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when release was updated
3275 User struct {
3276 Email string `json:"email" url:"email,key"` // unique email address of account
3277 ID string `json:"id" url:"id,key"` // unique identifier of an account
3278 } `json:"user" url:"user,key"` // user that created the release
3279 Version int `json:"version" url:"version,key"` // unique version assigned to the release
3280 }
3281
3282 // List latest slug releases for each app in a pipeline
3283 func (s *Service) PipelineDeploymentList(ctx context.Context, pipelineID string, lr *ListRange) (PipelineDeploymentListResult, error) {
3284 var pipelineDeployment PipelineDeploymentListResult
3285 return pipelineDeployment, s.Get(ctx, &pipelineDeployment, fmt.Sprintf("/pipelines/%v/latest-deployments", pipelineID), nil, lr)
3286 }
3287
3288 // Promotions allow you to move code from an app in a pipeline to all
3289 // targets
3290 type PipelinePromotion struct {
3291 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when promotion was created
3292 ID string `json:"id" url:"id,key"` // unique identifier of promotion
3293 Pipeline struct {
3294 ID string `json:"id" url:"id,key"` // unique identifier of pipeline
3295 } `json:"pipeline" url:"pipeline,key"` // the pipeline which the promotion belongs to
3296 Source struct {
3297 App struct {
3298 ID string `json:"id" url:"id,key"` // unique identifier of app
3299 } `json:"app" url:"app,key"` // the app which was promoted from
3300 Release struct {
3301 ID string `json:"id" url:"id,key"` // unique identifier of release
3302 } `json:"release" url:"release,key"` // the release used to promoted from
3303 } `json:"source" url:"source,key"` // the app being promoted from
3304 Status string `json:"status" url:"status,key"` // status of promotion
3305 UpdatedAt *time.Time `json:"updated_at" url:"updated_at,key"` // when promotion was updated
3306 }
3307 type PipelinePromotionCreateOpts struct {
3308 Pipeline struct {
3309 ID string `json:"id" url:"id,key"` // unique identifier of pipeline
3310 } `json:"pipeline" url:"pipeline,key"` // pipeline involved in the promotion
3311 Source struct {
3312 App *struct {
3313 ID *string `json:"id,omitempty" url:"id,omitempty,key"` // unique identifier of app
3314 } `json:"app,omitempty" url:"app,omitempty,key"` // the app which was promoted from
3315 } `json:"source" url:"source,key"` // the app being promoted from
3316 Targets []struct {
3317 App *struct {
3318 ID *string `json:"id,omitempty" url:"id,omitempty,key"` // unique identifier of app
3319 } `json:"app,omitempty" url:"app,omitempty,key"` // the app is being promoted to
3320 } `json:"targets" url:"targets,key"`
3321 }
3322
3323 // Create a new promotion.
3324 func (s *Service) PipelinePromotionCreate(ctx context.Context, o PipelinePromotionCreateOpts) (*PipelinePromotion, error) {
3325 var pipelinePromotion PipelinePromotion
3326 return &pipelinePromotion, s.Post(ctx, &pipelinePromotion, fmt.Sprintf("/pipeline-promotions"), o)
3327 }
3328
3329 // Info for existing pipeline promotion.
3330 func (s *Service) PipelinePromotionInfo(ctx context.Context, pipelinePromotionIdentity string) (*PipelinePromotion, error) {
3331 var pipelinePromotion PipelinePromotion
3332 return &pipelinePromotion, s.Get(ctx, &pipelinePromotion, fmt.Sprintf("/pipeline-promotions/%v", pipelinePromotionIdentity), nil, nil)
3333 }
3334
3335 // Promotion targets represent an individual app being promoted to
3336 type PipelinePromotionTarget struct {
3337 App struct {
3338 ID string `json:"id" url:"id,key"` // unique identifier of app
3339 } `json:"app" url:"app,key"` // the app which was promoted to
3340 ErrorMessage *string `json:"error_message" url:"error_message,key"` // an error message for why the promotion failed
3341 ID string `json:"id" url:"id,key"` // unique identifier of promotion target
3342 PipelinePromotion struct {
3343 ID string `json:"id" url:"id,key"` // unique identifier of promotion
3344 } `json:"pipeline_promotion" url:"pipeline_promotion,key"` // the promotion which the target belongs to
3345 Release *struct {
3346 ID string `json:"id" url:"id,key"` // unique identifier of release
3347 } `json:"release" url:"release,key"` // the release which was created on the target app
3348 Status string `json:"status" url:"status,key"` // status of promotion
3349 }
3350 type PipelinePromotionTargetListResult []PipelinePromotionTarget
3351
3352 // List promotion targets belonging to an existing promotion.
3353 func (s *Service) PipelinePromotionTargetList(ctx context.Context, pipelinePromotionID string, lr *ListRange) (PipelinePromotionTargetListResult, error) {
3354 var pipelinePromotionTarget PipelinePromotionTargetListResult
3355 return pipelinePromotionTarget, s.Get(ctx, &pipelinePromotionTarget, fmt.Sprintf("/pipeline-promotions/%v/promotion-targets", pipelinePromotionID), nil, lr)
3356 }
3357
3358 // Information about latest releases of apps in a pipeline.
3359 type PipelineRelease struct{}
3360 type PipelineReleaseListResult []struct {
3361 AddonPlanNames []string `json:"addon_plan_names" url:"addon_plan_names,key"` // add-on plans installed on the app for this release
3362 App struct {
3363 ID string `json:"id" url:"id,key"` // unique identifier of app
3364 Name string `json:"name" url:"name,key"` // unique name of app
3365 } `json:"app" url:"app,key"` // app involved in the release
3366 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when release was created
3367 Current bool `json:"current" url:"current,key"` // indicates this release as being the current one for the app
3368 Description string `json:"description" url:"description,key"` // description of changes in this release
3369 ID string `json:"id" url:"id,key"` // unique identifier of release
3370 OutputStreamURL *string `json:"output_stream_url" url:"output_stream_url,key"` // Release command output will be available from this URL as a stream.
3371 // The stream is available as either `text/plain` or
3372 // `text/event-stream`. Clients should be prepared to handle disconnects
3373 // and can resume the stream by sending a `Range` header (for
3374 // `text/plain`) or a `Last-Event-Id` header (for `text/event-stream`).
3375 Slug *struct {
3376 ID string `json:"id" url:"id,key"` // unique identifier of slug
3377 } `json:"slug" url:"slug,key"` // slug running in this release
3378 Status string `json:"status" url:"status,key"` // current status of the release
3379 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when release was updated
3380 User struct {
3381 Email string `json:"email" url:"email,key"` // unique email address of account
3382 ID string `json:"id" url:"id,key"` // unique identifier of an account
3383 } `json:"user" url:"user,key"` // user that created the release
3384 Version int `json:"version" url:"version,key"` // unique version assigned to the release
3385 }
3386
3387 // List latest releases for each app in a pipeline
3388 func (s *Service) PipelineReleaseList(ctx context.Context, pipelineID string, lr *ListRange) (PipelineReleaseListResult, error) {
3389 var pipelineRelease PipelineReleaseListResult
3390 return pipelineRelease, s.Get(ctx, &pipelineRelease, fmt.Sprintf("/pipelines/%v/latest-releases", pipelineID), nil, lr)
3391 }
3392
3393 // A pipeline's stack is determined by the apps in the pipeline. This is
3394 // used during creation of CI and Review Apps that have no stack defined
3395 // in app.json
3396 type PipelineStack struct {
3397 Stack *struct {
3398 ID string `json:"id" url:"id,key"` // unique identifier of stack
3399 Name string `json:"name" url:"name,key"` // unique name of stack
3400 } `json:"stack" url:"stack,key"` // identity of the stack that will be used for new builds without a
3401 // stack defined in CI and Review Apps
3402 }
3403
3404 // The stack for a given pipeline, used for CI and Review Apps that have
3405 // no stack defined in app.json.
3406 func (s *Service) PipelineStackDefaultStack(ctx context.Context, pipelineID string) (*PipelineStack, error) {
3407 var pipelineStack PipelineStack
3408 return &pipelineStack, s.Get(ctx, &pipelineStack, fmt.Sprintf("/pipelines/%v/pipeline-stack", pipelineID), nil, nil)
3409 }
3410
3411 // A pipeline transfer is the process of changing pipeline ownership
3412 // along with the contained apps.
3413 type PipelineTransfer struct {
3414 NewOwner *struct {
3415 ID string `json:"id" url:"id,key"` // unique identifier of a pipeline owner
3416 Type string `json:"type" url:"type,key"` // type of pipeline owner
3417 } `json:"new_owner" url:"new_owner,key"` // Owner of a pipeline.
3418 Pipeline struct {
3419 ID string `json:"id" url:"id,key"` // unique identifier of pipeline
3420 } `json:"pipeline" url:"pipeline,key"` // pipeline being transferred
3421 PreviousOwner *struct {
3422 ID string `json:"id" url:"id,key"` // unique identifier of a pipeline owner
3423 Type string `json:"type" url:"type,key"` // type of pipeline owner
3424 } `json:"previous_owner" url:"previous_owner,key"` // Owner of a pipeline.
3425 }
3426 type PipelineTransferCreateOpts struct {
3427 NewOwner struct {
3428 ID *string `json:"id,omitempty" url:"id,omitempty,key"` // unique identifier of a pipeline owner
3429 Type *string `json:"type,omitempty" url:"type,omitempty,key"` // type of pipeline owner
3430 } `json:"new_owner" url:"new_owner,key"` // New pipeline owner
3431 Pipeline struct {
3432 ID *string `json:"id,omitempty" url:"id,omitempty,key"` // unique identifier of pipeline
3433 } `json:"pipeline" url:"pipeline,key"` // The pipeline to transfer
3434 }
3435
3436 // Create a new pipeline transfer.
3437 func (s *Service) PipelineTransferCreate(ctx context.Context, o PipelineTransferCreateOpts) (*PipelineTransfer, error) {
3438 var pipelineTransfer PipelineTransfer
3439 return &pipelineTransfer, s.Post(ctx, &pipelineTransfer, fmt.Sprintf("/pipeline-transfers"), o)
3440 }
3441
3442 // Plans represent different configurations of add-ons that may be added
3443 // to apps. Endpoints under add-on services can be accessed without
3444 // authentication.
3445 type Plan struct {
3446 AddonService struct {
3447 ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
3448 Name string `json:"name" url:"name,key"` // unique name of this add-on-service
3449 } `json:"addon_service" url:"addon_service,key"` // identity of add-on service
3450 Compliance []string `json:"compliance" url:"compliance,key"` // the compliance regimes applied to an add-on plan
3451 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when plan was created
3452 Default bool `json:"default" url:"default,key"` // whether this plan is the default for its add-on service
3453 Description string `json:"description" url:"description,key"` // description of plan
3454 HumanName string `json:"human_name" url:"human_name,key"` // human readable name of the add-on plan
3455 ID string `json:"id" url:"id,key"` // unique identifier of this plan
3456 InstallableInsidePrivateNetwork bool `json:"installable_inside_private_network" url:"installable_inside_private_network,key"` // whether this plan is installable to a Private Spaces app
3457 InstallableOutsidePrivateNetwork bool `json:"installable_outside_private_network" url:"installable_outside_private_network,key"` // whether this plan is installable to a Common Runtime app
3458 Name string `json:"name" url:"name,key"` // unique name of this plan
3459 Price struct {
3460 Cents int `json:"cents" url:"cents,key"` // price in cents per unit of plan
3461 Contract bool `json:"contract" url:"contract,key"` // price is negotiated in a contract outside of monthly add-on billing
3462 Unit string `json:"unit" url:"unit,key"` // unit of price for plan
3463 } `json:"price" url:"price,key"` // price
3464 SpaceDefault bool `json:"space_default" url:"space_default,key"` // whether this plan is the default for apps in Private Spaces
3465 State string `json:"state" url:"state,key"` // release status for plan
3466 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when plan was updated
3467 Visible bool `json:"visible" url:"visible,key"` // whether this plan is publicly visible
3468 }
3469
3470 // Info for existing plan.
3471 func (s *Service) PlanInfo(ctx context.Context, planIdentity string) (*Plan, error) {
3472 var plan Plan
3473 return &plan, s.Get(ctx, &plan, fmt.Sprintf("/plans/%v", planIdentity), nil, nil)
3474 }
3475
3476 // Info for existing plan by Add-on.
3477 func (s *Service) PlanInfoByAddOn(ctx context.Context, addOnServiceIdentity string, planIdentity string) (*Plan, error) {
3478 var plan Plan
3479 return &plan, s.Get(ctx, &plan, fmt.Sprintf("/addon-services/%v/plans/%v", addOnServiceIdentity, planIdentity), nil, nil)
3480 }
3481
3482 type PlanListByAddOnResult []Plan
3483
3484 // List existing plans by Add-on.
3485 func (s *Service) PlanListByAddOn(ctx context.Context, addOnServiceIdentity string, lr *ListRange) (PlanListByAddOnResult, error) {
3486 var plan PlanListByAddOnResult
3487 return plan, s.Get(ctx, &plan, fmt.Sprintf("/addon-services/%v/plans", addOnServiceIdentity), nil, lr)
3488 }
3489
3490 // Rate Limit represents the number of request tokens each account
3491 // holds. Requests to this endpoint do not count towards the rate limit.
3492 type RateLimit struct {
3493 Remaining int `json:"remaining" url:"remaining,key"` // allowed requests remaining in current interval
3494 }
3495
3496 // Info for rate limits.
3497 func (s *Service) RateLimitInfo(ctx context.Context) (*RateLimit, error) {
3498 var rateLimit RateLimit
3499 return &rateLimit, s.Get(ctx, &rateLimit, fmt.Sprintf("/account/rate-limits"), nil, nil)
3500 }
3501
3502 // A region represents a geographic location in which your application
3503 // may run.
3504 type Region struct {
3505 Country string `json:"country" url:"country,key"` // country where the region exists
3506 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when region was created
3507 Description string `json:"description" url:"description,key"` // description of region
3508 ID string `json:"id" url:"id,key"` // unique identifier of region
3509 Locale string `json:"locale" url:"locale,key"` // area in the country where the region exists
3510 Name string `json:"name" url:"name,key"` // unique name of region
3511 PrivateCapable bool `json:"private_capable" url:"private_capable,key"` // whether or not region is available for creating a Private Space
3512 Provider struct {
3513 Name string `json:"name" url:"name,key"` // name of provider
3514 Region string `json:"region" url:"region,key"` // region name used by provider
3515 } `json:"provider" url:"provider,key"` // provider of underlying substrate
3516 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when region was updated
3517 }
3518
3519 // Info for existing region.
3520 func (s *Service) RegionInfo(ctx context.Context, regionIdentity string) (*Region, error) {
3521 var region Region
3522 return &region, s.Get(ctx, &region, fmt.Sprintf("/regions/%v", regionIdentity), nil, nil)
3523 }
3524
3525 type RegionListResult []Region
3526
3527 // List existing regions.
3528 func (s *Service) RegionList(ctx context.Context, lr *ListRange) (RegionListResult, error) {
3529 var region RegionListResult
3530 return region, s.Get(ctx, &region, fmt.Sprintf("/regions"), nil, lr)
3531 }
3532
3533 // A release represents a combination of code, config vars and add-ons
3534 // for an app on Heroku.
3535 type Release struct {
3536 AddonPlanNames []string `json:"addon_plan_names" url:"addon_plan_names,key"` // add-on plans installed on the app for this release
3537 App struct {
3538 ID string `json:"id" url:"id,key"` // unique identifier of app
3539 Name string `json:"name" url:"name,key"` // unique name of app
3540 } `json:"app" url:"app,key"` // app involved in the release
3541 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when release was created
3542 Current bool `json:"current" url:"current,key"` // indicates this release as being the current one for the app
3543 Description string `json:"description" url:"description,key"` // description of changes in this release
3544 ID string `json:"id" url:"id,key"` // unique identifier of release
3545 OutputStreamURL *string `json:"output_stream_url" url:"output_stream_url,key"` // Release command output will be available from this URL as a stream.
3546 // The stream is available as either `text/plain` or
3547 // `text/event-stream`. Clients should be prepared to handle disconnects
3548 // and can resume the stream by sending a `Range` header (for
3549 // `text/plain`) or a `Last-Event-Id` header (for `text/event-stream`).
3550 Slug *struct {
3551 ID string `json:"id" url:"id,key"` // unique identifier of slug
3552 } `json:"slug" url:"slug,key"` // slug running in this release
3553 Status string `json:"status" url:"status,key"` // current status of the release
3554 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when release was updated
3555 User struct {
3556 Email string `json:"email" url:"email,key"` // unique email address of account
3557 ID string `json:"id" url:"id,key"` // unique identifier of an account
3558 } `json:"user" url:"user,key"` // user that created the release
3559 Version int `json:"version" url:"version,key"` // unique version assigned to the release
3560 }
3561
3562 // Info for existing release.
3563 func (s *Service) ReleaseInfo(ctx context.Context, appIdentity string, releaseIdentity string) (*Release, error) {
3564 var release Release
3565 return &release, s.Get(ctx, &release, fmt.Sprintf("/apps/%v/releases/%v", appIdentity, releaseIdentity), nil, nil)
3566 }
3567
3568 type ReleaseListResult []Release
3569
3570 // List existing releases.
3571 func (s *Service) ReleaseList(ctx context.Context, appIdentity string, lr *ListRange) (ReleaseListResult, error) {
3572 var release ReleaseListResult
3573 return release, s.Get(ctx, &release, fmt.Sprintf("/apps/%v/releases", appIdentity), nil, lr)
3574 }
3575
3576 type ReleaseCreateOpts struct {
3577 Description *string `json:"description,omitempty" url:"description,omitempty,key"` // description of changes in this release
3578 Slug string `json:"slug" url:"slug,key"` // unique identifier of slug
3579 }
3580
3581 // Create new release.
3582 func (s *Service) ReleaseCreate(ctx context.Context, appIdentity string, o ReleaseCreateOpts) (*Release, error) {
3583 var release Release
3584 return &release, s.Post(ctx, &release, fmt.Sprintf("/apps/%v/releases", appIdentity), o)
3585 }
3586
3587 type ReleaseRollbackOpts struct {
3588 Release string `json:"release" url:"release,key"` // unique identifier of release
3589 }
3590
3591 // Rollback to an existing release.
3592 func (s *Service) ReleaseRollback(ctx context.Context, appIdentity string, o ReleaseRollbackOpts) (*Release, error) {
3593 var release Release
3594 return &release, s.Post(ctx, &release, fmt.Sprintf("/apps/%v/releases", appIdentity), o)
3595 }
3596
3597 // An ephemeral app to review a set of changes
3598 type ReviewApp struct {
3599 App *struct {
3600 ID string `json:"id" url:"id,key"` // unique identifier of app
3601 } `json:"app" url:"app,key"` // the Heroku app associated to this review app
3602 AppSetup *struct {
3603 ID string `json:"id" url:"id,key"` // unique identifier of app setup
3604 } `json:"app_setup" url:"app_setup,key"` // the app setup for this review app
3605 Branch string `json:"branch" url:"branch,key"` // the branch of the repository which the review app is based on
3606 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when test run was created
3607 Creator struct{} `json:"creator" url:"creator,key"` // The user who created the review app
3608 ErrorStatus *string `json:"error_status" url:"error_status,key"` // error message from creating the review app if any
3609 ForkRepo *struct {
3610 ID *int `json:"id" url:"id,key"` // repository id of the fork the branch resides in
3611 } `json:"fork_repo" url:"fork_repo,key"`
3612 ID string `json:"id" url:"id,key"` // unique identifier of the review app
3613 Message *string `json:"message" url:"message,key"` // message from creating the review app if any
3614 Pipeline struct {
3615 ID string `json:"id" url:"id,key"` // unique identifier of pipeline
3616 } `json:"pipeline" url:"pipeline,key"` // the pipeline which this review app belongs to
3617 PrNumber *int `json:"pr_number" url:"pr_number,key"` // pull request number the review app is built for
3618 Status string `json:"status" url:"status,key"` // current state of the review app
3619 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when review app was updated
3620 WaitForCi bool `json:"wait_for_ci" url:"wait_for_ci,key"` // wait for ci before building the app
3621 }
3622 type ReviewAppCreateOpts struct {
3623 Branch string `json:"branch" url:"branch,key"` // the branch of the repository which the review app is based on
3624 Environment map[string]*string `json:"environment,omitempty" url:"environment,omitempty,key"` // hash of config vars
3625 ForkRepoID *int `json:"fork_repo_id,omitempty" url:"fork_repo_id,omitempty,key"` // repository id of the fork the branch resides in
3626 Pipeline string `json:"pipeline" url:"pipeline,key"` // unique identifier of pipeline
3627 PrNumber *int `json:"pr_number,omitempty" url:"pr_number,omitempty,key"` // pull request number the review app is built for
3628 SourceBlob struct {
3629 URL *string `json:"url,omitempty" url:"url,omitempty,key"` // URL where gzipped tar archive of source code for build was
3630 // downloaded.
3631 Version *string `json:"version,omitempty" url:"version,omitempty,key"` // The version number (or SHA) of the code to build.
3632 } `json:"source_blob" url:"source_blob,key"` // The download location for the review app's source code
3633 }
3634
3635 // Create a new review app
3636 func (s *Service) ReviewAppCreate(ctx context.Context, o ReviewAppCreateOpts) (*ReviewApp, error) {
3637 var reviewApp ReviewApp
3638 return &reviewApp, s.Post(ctx, &reviewApp, fmt.Sprintf("/review-apps"), o)
3639 }
3640
3641 // Gets an existing review app
3642 func (s *Service) ReviewAppGetReviewApp(ctx context.Context, reviewAppID string) (*ReviewApp, error) {
3643 var reviewApp ReviewApp
3644 return &reviewApp, s.Get(ctx, &reviewApp, fmt.Sprintf("/review-apps/%v", reviewAppID), nil, nil)
3645 }
3646
3647 // Delete an existing review app
3648 func (s *Service) ReviewAppDelete(ctx context.Context, reviewAppID string) (*ReviewApp, error) {
3649 var reviewApp ReviewApp
3650 return &reviewApp, s.Delete(ctx, &reviewApp, fmt.Sprintf("/review-apps/%v", reviewAppID))
3651 }
3652
3653 // Get a review app using the associated app_id
3654 func (s *Service) ReviewAppGetReviewAppByAppID(ctx context.Context, appIdentity string) (*ReviewApp, error) {
3655 var reviewApp ReviewApp
3656 return &reviewApp, s.Get(ctx, &reviewApp, fmt.Sprintf("/apps/%v/review-app", appIdentity), nil, nil)
3657 }
3658
3659 type ReviewAppListResult []ReviewApp
3660
3661 // List review apps for a pipeline
3662 func (s *Service) ReviewAppList(ctx context.Context, pipelineID string, lr *ListRange) (ReviewAppListResult, error) {
3663 var reviewApp ReviewAppListResult
3664 return reviewApp, s.Get(ctx, &reviewApp, fmt.Sprintf("/pipelines/%v/review-apps", pipelineID), nil, lr)
3665 }
3666
3667 // Review apps can be configured for pipelines.
3668 type ReviewAppConfig struct {
3669 AutomaticReviewApps bool `json:"automatic_review_apps" url:"automatic_review_apps,key"` // enable automatic review apps for pull requests
3670 BaseName *string `json:"base_name" url:"base_name,key"` // A unique prefix that will be used to create review app names
3671 DeployTarget *struct {
3672 ID string `json:"id" url:"id,key"` // unique identifier of deploy target
3673 Type string `json:"type" url:"type,key"` // type of deploy target
3674 } `json:"deploy_target" url:"deploy_target,key"` // the deploy target for the review apps of a pipeline
3675 DestroyStaleApps bool `json:"destroy_stale_apps" url:"destroy_stale_apps,key"` // automatically destroy review apps when they haven't been deployed for
3676 // a number of days
3677 PipelineID string `json:"pipeline_id" url:"pipeline_id,key"` // unique identifier of pipeline
3678 Repo struct {
3679 ID int `json:"id" url:"id,key"` // repository id
3680 } `json:"repo" url:"repo,key"`
3681 StaleDays int `json:"stale_days" url:"stale_days,key"` // number of days without a deployment after which to consider a review
3682 // app stale
3683 WaitForCi bool `json:"wait_for_ci" url:"wait_for_ci,key"` // If true, review apps are created only when CI passes
3684 }
3685 type ReviewAppConfigEnableOpts struct {
3686 AutomaticReviewApps *bool `json:"automatic_review_apps,omitempty" url:"automatic_review_apps,omitempty,key"` // enable automatic review apps for pull requests
3687 BaseName *string `json:"base_name,omitempty" url:"base_name,omitempty,key"` // A unique prefix that will be used to create review app names
3688 DeployTarget *struct {
3689 ID string `json:"id" url:"id,key"` // unique identifier of deploy target
3690 Type string `json:"type" url:"type,key"` // type of deploy target
3691 } `json:"deploy_target,omitempty" url:"deploy_target,omitempty,key"` // the deploy target for the review apps of a pipeline
3692 DestroyStaleApps *bool `json:"destroy_stale_apps,omitempty" url:"destroy_stale_apps,omitempty,key"` // automatically destroy review apps when they haven't been deployed for
3693 // a number of days
3694 Repo string `json:"repo" url:"repo,key"` // repository name
3695 StaleDays *int `json:"stale_days,omitempty" url:"stale_days,omitempty,key"` // number of days without a deployment after which to consider a review
3696 // app stale
3697 WaitForCi *bool `json:"wait_for_ci,omitempty" url:"wait_for_ci,omitempty,key"` // If true, review apps are created only when CI passes
3698 }
3699
3700 // Enable review apps for a pipeline
3701 func (s *Service) ReviewAppConfigEnable(ctx context.Context, pipelineID string, o ReviewAppConfigEnableOpts) (*ReviewAppConfig, error) {
3702 var reviewAppConfig ReviewAppConfig
3703 return &reviewAppConfig, s.Post(ctx, &reviewAppConfig, fmt.Sprintf("/pipelines/%v/review-app-config", pipelineID), o)
3704 }
3705
3706 // Get review apps configuration for a pipeline
3707 func (s *Service) ReviewAppConfigInfo(ctx context.Context, pipelineID string) (*ReviewAppConfig, error) {
3708 var reviewAppConfig ReviewAppConfig
3709 return &reviewAppConfig, s.Get(ctx, &reviewAppConfig, fmt.Sprintf("/pipelines/%v/review-app-config", pipelineID), nil, nil)
3710 }
3711
3712 type ReviewAppConfigUpdateOpts struct {
3713 AutomaticReviewApps *bool `json:"automatic_review_apps,omitempty" url:"automatic_review_apps,omitempty,key"` // enable automatic review apps for pull requests
3714 BaseName *string `json:"base_name,omitempty" url:"base_name,omitempty,key"` // A unique prefix that will be used to create review app names
3715 DeployTarget *struct {
3716 ID string `json:"id" url:"id,key"` // unique identifier of deploy target
3717 Type string `json:"type" url:"type,key"` // type of deploy target
3718 } `json:"deploy_target,omitempty" url:"deploy_target,omitempty,key"` // the deploy target for the review apps of a pipeline
3719 DestroyStaleApps *bool `json:"destroy_stale_apps,omitempty" url:"destroy_stale_apps,omitempty,key"` // automatically destroy review apps when they haven't been deployed for
3720 // a number of days
3721 StaleDays *int `json:"stale_days,omitempty" url:"stale_days,omitempty,key"` // number of days without a deployment after which to consider a review
3722 // app stale
3723 WaitForCi *bool `json:"wait_for_ci,omitempty" url:"wait_for_ci,omitempty,key"` // If true, review apps are created only when CI passes
3724 }
3725
3726 // Update review app configuration for a pipeline
3727 func (s *Service) ReviewAppConfigUpdate(ctx context.Context, pipelineID string, o ReviewAppConfigUpdateOpts) (*ReviewAppConfig, error) {
3728 var reviewAppConfig ReviewAppConfig
3729 return &reviewAppConfig, s.Patch(ctx, &reviewAppConfig, fmt.Sprintf("/pipelines/%v/review-app-config", pipelineID), o)
3730 }
3731
3732 // Disable review apps for a pipeline
3733 func (s *Service) ReviewAppConfigDelete(ctx context.Context, pipelineID string) (*ReviewAppConfig, error) {
3734 var reviewAppConfig ReviewAppConfig
3735 return &reviewAppConfig, s.Delete(ctx, &reviewAppConfig, fmt.Sprintf("/pipelines/%v/review-app-config", pipelineID))
3736 }
3737
3738 // A slug is a snapshot of your application code that is ready to run on
3739 // the platform.
3740 type Slug struct {
3741 Blob struct {
3742 Method string `json:"method" url:"method,key"` // method to be used to interact with the slug blob
3743 URL string `json:"url" url:"url,key"` // URL to interact with the slug blob
3744 } `json:"blob" url:"blob,key"` // pointer to the url where clients can fetch or store the actual
3745 // release binary
3746 BuildpackProvidedDescription *string `json:"buildpack_provided_description" url:"buildpack_provided_description,key"` // description from buildpack of slug
3747 Checksum *string `json:"checksum" url:"checksum,key"` // an optional checksum of the slug for verifying its integrity
3748 Commit *string `json:"commit" url:"commit,key"` // identification of the code with your version control system (eg: SHA
3749 // of the git HEAD)
3750 CommitDescription *string `json:"commit_description" url:"commit_description,key"` // an optional description of the provided commit
3751 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when slug was created
3752 ID string `json:"id" url:"id,key"` // unique identifier of slug
3753 ProcessTypes map[string]string `json:"process_types" url:"process_types,key"` // hash mapping process type names to their respective command
3754 Size *int `json:"size" url:"size,key"` // size of slug, in bytes
3755 Stack struct {
3756 ID string `json:"id" url:"id,key"` // unique identifier of stack
3757 Name string `json:"name" url:"name,key"` // unique name of stack
3758 } `json:"stack" url:"stack,key"` // identity of slug stack
3759 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when slug was updated
3760 }
3761
3762 // Info for existing slug.
3763 func (s *Service) SlugInfo(ctx context.Context, appIdentity string, slugIdentity string) (*Slug, error) {
3764 var slug Slug
3765 return &slug, s.Get(ctx, &slug, fmt.Sprintf("/apps/%v/slugs/%v", appIdentity, slugIdentity), nil, nil)
3766 }
3767
3768 type SlugCreateOpts struct {
3769 BuildpackProvidedDescription *string `json:"buildpack_provided_description,omitempty" url:"buildpack_provided_description,omitempty,key"` // description from buildpack of slug
3770 Checksum *string `json:"checksum,omitempty" url:"checksum,omitempty,key"` // an optional checksum of the slug for verifying its integrity
3771 Commit *string `json:"commit,omitempty" url:"commit,omitempty,key"` // identification of the code with your version control system (eg: SHA
3772 // of the git HEAD)
3773 CommitDescription *string `json:"commit_description,omitempty" url:"commit_description,omitempty,key"` // an optional description of the provided commit
3774 ProcessTypes map[string]string `json:"process_types" url:"process_types,key"` // hash mapping process type names to their respective command
3775 Stack *string `json:"stack,omitempty" url:"stack,omitempty,key"` // unique name of stack
3776 }
3777
3778 // Create a new slug. For more information please refer to [Deploying
3779 // Slugs using the Platform
3780 // API](https://devcenter.heroku.com/articles/platform-api-deploying-slug
3781 // s).
3782 func (s *Service) SlugCreate(ctx context.Context, appIdentity string, o SlugCreateOpts) (*Slug, error) {
3783 var slug Slug
3784 return &slug, s.Post(ctx, &slug, fmt.Sprintf("/apps/%v/slugs", appIdentity), o)
3785 }
3786
3787 // SMS numbers are used for recovery on accounts with two-factor
3788 // authentication enabled.
3789 type SmsNumber struct {
3790 SmsNumber *string `json:"sms_number" url:"sms_number,key"` // SMS number of account
3791 }
3792
3793 // Recover an account using an SMS recovery code
3794 func (s *Service) SmsNumberSMSNumber(ctx context.Context, accountIdentity string) (*SmsNumber, error) {
3795 var smsNumber SmsNumber
3796 return &smsNumber, s.Get(ctx, &smsNumber, fmt.Sprintf("/users/%v/sms-number", accountIdentity), nil, nil)
3797 }
3798
3799 // Recover an account using an SMS recovery code
3800 func (s *Service) SmsNumberRecover(ctx context.Context, accountIdentity string) (*SmsNumber, error) {
3801 var smsNumber SmsNumber
3802 return &smsNumber, s.Post(ctx, &smsNumber, fmt.Sprintf("/users/%v/sms-number/actions/recover", accountIdentity), nil)
3803 }
3804
3805 // Confirm an SMS number change with a confirmation code
3806 func (s *Service) SmsNumberConfirm(ctx context.Context, accountIdentity string) (*SmsNumber, error) {
3807 var smsNumber SmsNumber
3808 return &smsNumber, s.Post(ctx, &smsNumber, fmt.Sprintf("/users/%v/sms-number/actions/confirm", accountIdentity), nil)
3809 }
3810
3811 // SNI Endpoint is a public address serving a custom SSL cert for HTTPS
3812 // traffic, using the SNI TLS extension, to a Heroku app.
3813 type SniEndpoint struct {
3814 App struct {
3815 ID string `json:"id" url:"id,key"` // unique identifier of app
3816 Name string `json:"name" url:"name,key"` // unique name of app
3817 } `json:"app" url:"app,key"` // application that this SSL certificate is on
3818 CertificateChain string `json:"certificate_chain" url:"certificate_chain,key"` // raw contents of the public certificate chain (eg: .crt or .pem file)
3819 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when endpoint was created
3820 DisplayName *string `json:"display_name" url:"display_name,key"` // unique name for SSL certificate
3821 Domains []string `json:"domains" url:"domains,key"` // domains associated with this SSL certificate
3822 ID string `json:"id" url:"id,key"` // unique identifier of this SNI endpoint
3823 Name string `json:"name" url:"name,key"` // unique name for SNI endpoint
3824 SSLCert struct {
3825 IsCaSigned bool `json:"ca_signed?" url:"ca_signed?,key"`
3826 CertDomains []interface{} `json:"cert_domains" url:"cert_domains,key"`
3827 ExpiresAt time.Time `json:"expires_at" url:"expires_at,key"`
3828 ID string `json:"id" url:"id,key"` // unique identifier of this SSL certificate
3829 Issuer string `json:"issuer" url:"issuer,key"`
3830 IsSelfSigned bool `json:"self_signed?" url:"self_signed?,key"`
3831 StartsAt time.Time `json:"starts_at" url:"starts_at,key"`
3832 Subject string `json:"subject" url:"subject,key"`
3833 } `json:"ssl_cert" url:"ssl_cert,key"` // certificate provided by this endpoint
3834 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when SNI endpoint was updated
3835 }
3836 type SniEndpointCreateOpts struct {
3837 CertificateChain string `json:"certificate_chain" url:"certificate_chain,key"` // raw contents of the public certificate chain (eg: .crt or .pem file)
3838 PrivateKey string `json:"private_key" url:"private_key,key"` // contents of the private key (eg .key file)
3839 }
3840
3841 // Create a new SNI endpoint.
3842 func (s *Service) SniEndpointCreate(ctx context.Context, appIdentity string, o SniEndpointCreateOpts) (*SniEndpoint, error) {
3843 var sniEndpoint SniEndpoint
3844 return &sniEndpoint, s.Post(ctx, &sniEndpoint, fmt.Sprintf("/apps/%v/sni-endpoints", appIdentity), o)
3845 }
3846
3847 // Delete existing SNI endpoint.
3848 func (s *Service) SniEndpointDelete(ctx context.Context, appIdentity string, sniEndpointIdentity string) (*SniEndpoint, error) {
3849 var sniEndpoint SniEndpoint
3850 return &sniEndpoint, s.Delete(ctx, &sniEndpoint, fmt.Sprintf("/apps/%v/sni-endpoints/%v", appIdentity, sniEndpointIdentity))
3851 }
3852
3853 // Info for existing SNI endpoint.
3854 func (s *Service) SniEndpointInfo(ctx context.Context, appIdentity string, sniEndpointIdentity string) (*SniEndpoint, error) {
3855 var sniEndpoint SniEndpoint
3856 return &sniEndpoint, s.Get(ctx, &sniEndpoint, fmt.Sprintf("/apps/%v/sni-endpoints/%v", appIdentity, sniEndpointIdentity), nil, nil)
3857 }
3858
3859 type SniEndpointListResult []SniEndpoint
3860
3861 // List existing SNI endpoints.
3862 func (s *Service) SniEndpointList(ctx context.Context, appIdentity string, lr *ListRange) (SniEndpointListResult, error) {
3863 var sniEndpoint SniEndpointListResult
3864 return sniEndpoint, s.Get(ctx, &sniEndpoint, fmt.Sprintf("/apps/%v/sni-endpoints", appIdentity), nil, lr)
3865 }
3866
3867 type SniEndpointUpdateOpts struct {
3868 CertificateChain string `json:"certificate_chain" url:"certificate_chain,key"` // raw contents of the public certificate chain (eg: .crt or .pem file)
3869 PrivateKey string `json:"private_key" url:"private_key,key"` // contents of the private key (eg .key file)
3870 }
3871
3872 // Update an existing SNI endpoint.
3873 func (s *Service) SniEndpointUpdate(ctx context.Context, appIdentity string, sniEndpointIdentity string, o SniEndpointUpdateOpts) (*SniEndpoint, error) {
3874 var sniEndpoint SniEndpoint
3875 return &sniEndpoint, s.Patch(ctx, &sniEndpoint, fmt.Sprintf("/apps/%v/sni-endpoints/%v", appIdentity, sniEndpointIdentity), o)
3876 }
3877
3878 // A source is a location for uploading and downloading an application's
3879 // source code.
3880 type Source struct {
3881 SourceBlob struct {
3882 GetURL string `json:"get_url" url:"get_url,key"` // URL to download the source
3883 PutURL string `json:"put_url" url:"put_url,key"` // URL to upload the source
3884 } `json:"source_blob" url:"source_blob,key"` // pointer to the URL where clients can fetch or store the source
3885 }
3886
3887 // Create URLs for uploading and downloading source.
3888 func (s *Service) SourceCreate(ctx context.Context) (*Source, error) {
3889 var source Source
3890 return &source, s.Post(ctx, &source, fmt.Sprintf("/sources"), nil)
3891 }
3892
3893 // Create URLs for uploading and downloading source. Deprecated in favor
3894 // of `POST /sources`
3895 func (s *Service) SourceCreateDeprecated(ctx context.Context, appIdentity string) (*Source, error) {
3896 var source Source
3897 return &source, s.Post(ctx, &source, fmt.Sprintf("/apps/%v/sources", appIdentity), nil)
3898 }
3899
3900 // A space is an isolated, highly available, secure app execution
3901 // environment.
3902 type Space struct {
3903 CIDR string `json:"cidr" url:"cidr,key"` // The RFC-1918 CIDR the Private Space will use. It must be a /16 in
3904 // 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16
3905 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when space was created
3906 DataCIDR string `json:"data_cidr" url:"data_cidr,key"` // The RFC-1918 CIDR that the Private Space will use for the
3907 // Heroku-managed peering connection that's automatically created when
3908 // using Heroku Data add-ons. It must be between a /16 and a /20
3909 ID string `json:"id" url:"id,key"` // unique identifier of space
3910 Name string `json:"name" url:"name,key"` // unique name of space
3911 Organization struct {
3912 Name string `json:"name" url:"name,key"` // unique name of team
3913 } `json:"organization" url:"organization,key"` // organization that owns this space
3914 Region struct {
3915 ID string `json:"id" url:"id,key"` // unique identifier of region
3916 Name string `json:"name" url:"name,key"` // unique name of region
3917 } `json:"region" url:"region,key"` // identity of space region
3918 Shield bool `json:"shield" url:"shield,key"` // true if this space has shield enabled
3919 State string `json:"state" url:"state,key"` // availability of this space
3920 Team struct {
3921 ID string `json:"id" url:"id,key"` // unique identifier of team
3922 Name string `json:"name" url:"name,key"` // unique name of team
3923 } `json:"team" url:"team,key"` // team that owns this space
3924 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when space was updated
3925 }
3926 type SpaceListResult []Space
3927
3928 // List existing spaces.
3929 func (s *Service) SpaceList(ctx context.Context, lr *ListRange) (SpaceListResult, error) {
3930 var space SpaceListResult
3931 return space, s.Get(ctx, &space, fmt.Sprintf("/spaces"), nil, lr)
3932 }
3933
3934 // Info for existing space.
3935 func (s *Service) SpaceInfo(ctx context.Context, spaceIdentity string) (*Space, error) {
3936 var space Space
3937 return &space, s.Get(ctx, &space, fmt.Sprintf("/spaces/%v", spaceIdentity), nil, nil)
3938 }
3939
3940 type SpaceUpdateOpts struct {
3941 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of space
3942 }
3943
3944 // Update an existing space.
3945 func (s *Service) SpaceUpdate(ctx context.Context, spaceIdentity string, o SpaceUpdateOpts) (*Space, error) {
3946 var space Space
3947 return &space, s.Patch(ctx, &space, fmt.Sprintf("/spaces/%v", spaceIdentity), o)
3948 }
3949
3950 // Delete an existing space.
3951 func (s *Service) SpaceDelete(ctx context.Context, spaceIdentity string) (*Space, error) {
3952 var space Space
3953 return &space, s.Delete(ctx, &space, fmt.Sprintf("/spaces/%v", spaceIdentity))
3954 }
3955
3956 type SpaceCreateOpts struct {
3957 CIDR *string `json:"cidr,omitempty" url:"cidr,omitempty,key"` // The RFC-1918 CIDR the Private Space will use. It must be a /16 in
3958 // 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16
3959 DataCIDR *string `json:"data_cidr,omitempty" url:"data_cidr,omitempty,key"` // The RFC-1918 CIDR that the Private Space will use for the
3960 // Heroku-managed peering connection that's automatically created when
3961 // using Heroku Data add-ons. It must be between a /16 and a /20
3962 LogDrainURL *string `json:"log_drain_url,omitempty" url:"log_drain_url,omitempty,key"` // URL to which all apps will drain logs. Only settable during space
3963 // creation and enables direct logging. Must use HTTPS.
3964 Name string `json:"name" url:"name,key"` // unique name of space
3965 Region *string `json:"region,omitempty" url:"region,omitempty,key"` // unique identifier of region
3966 Shield *bool `json:"shield,omitempty" url:"shield,omitempty,key"` // true if this space has shield enabled
3967 Team string `json:"team" url:"team,key"` // unique name of team
3968 }
3969
3970 // Create a new space.
3971 func (s *Service) SpaceCreate(ctx context.Context, o SpaceCreateOpts) (*Space, error) {
3972 var space Space
3973 return &space, s.Post(ctx, &space, fmt.Sprintf("/spaces"), o)
3974 }
3975
3976 // Space access represents the permissions a particular user has on a
3977 // particular space.
3978 type SpaceAppAccess struct {
3979 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when space was created
3980 ID string `json:"id" url:"id,key"` // unique identifier of space
3981 Permissions []struct {
3982 Description string `json:"description" url:"description,key"`
3983 Name string `json:"name" url:"name,key"`
3984 } `json:"permissions" url:"permissions,key"` // user space permissions
3985 Space struct {
3986 ID string `json:"id" url:"id,key"` // unique identifier of app
3987 Name string `json:"name" url:"name,key"` // unique name of app
3988 } `json:"space" url:"space,key"` // space user belongs to
3989 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when space was updated
3990 User struct {
3991 Email string `json:"email" url:"email,key"` // unique email address of account
3992 ID string `json:"id" url:"id,key"` // unique identifier of an account
3993 } `json:"user" url:"user,key"` // identity of user account
3994 }
3995
3996 // List permissions for a given user on a given space.
3997 func (s *Service) SpaceAppAccessInfo(ctx context.Context, spaceIdentity string, accountIdentity string) (*SpaceAppAccess, error) {
3998 var spaceAppAccess SpaceAppAccess
3999 return &spaceAppAccess, s.Get(ctx, &spaceAppAccess, fmt.Sprintf("/spaces/%v/members/%v", spaceIdentity, accountIdentity), nil, nil)
4000 }
4001
4002 type SpaceAppAccessUpdateOpts struct {
4003 Permissions []struct {
4004 Name *string `json:"name,omitempty" url:"name,omitempty,key"`
4005 } `json:"permissions" url:"permissions,key"`
4006 }
4007
4008 // Update an existing user's set of permissions on a space.
4009 func (s *Service) SpaceAppAccessUpdate(ctx context.Context, spaceIdentity string, accountIdentity string, o SpaceAppAccessUpdateOpts) (*SpaceAppAccess, error) {
4010 var spaceAppAccess SpaceAppAccess
4011 return &spaceAppAccess, s.Patch(ctx, &spaceAppAccess, fmt.Sprintf("/spaces/%v/members/%v", spaceIdentity, accountIdentity), o)
4012 }
4013
4014 type SpaceAppAccessListResult []SpaceAppAccess
4015
4016 // List all users and their permissions on a space.
4017 func (s *Service) SpaceAppAccessList(ctx context.Context, spaceIdentity string, lr *ListRange) (SpaceAppAccessListResult, error) {
4018 var spaceAppAccess SpaceAppAccessListResult
4019 return spaceAppAccess, s.Get(ctx, &spaceAppAccess, fmt.Sprintf("/spaces/%v/members", spaceIdentity), nil, lr)
4020 }
4021
4022 // Network address translation (NAT) for stable outbound IP addresses
4023 // from a space
4024 type SpaceNAT struct {
4025 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when network address translation for a space was created
4026 Sources []string `json:"sources" url:"sources,key"` // potential IPs from which outbound network traffic will originate
4027 State string `json:"state" url:"state,key"` // availability of network address translation for a space
4028 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when network address translation for a space was updated
4029 }
4030
4031 // Current state of network address translation for a space.
4032 func (s *Service) SpaceNATInfo(ctx context.Context, spaceIdentity string) (*SpaceNAT, error) {
4033 var spaceNAT SpaceNAT
4034 return &spaceNAT, s.Get(ctx, &spaceNAT, fmt.Sprintf("/spaces/%v/nat", spaceIdentity), nil, nil)
4035 }
4036
4037 // Space Topology provides you with a mechanism for viewing all the
4038 // running dynos, formations and applications for a space. This is the
4039 // same data thats used to power our DNS Service Discovery.
4040 type SpaceTopology struct {
4041 Apps []struct {
4042 Domains []interface{} `json:"domains" url:"domains,key"`
4043 Formation []struct {
4044 Dynos []struct {
4045 Hostname string `json:"hostname" url:"hostname,key"` // localspace hostname of resource
4046 ID string `json:"id" url:"id,key"` // unique identifier of this dyno
4047 Number int `json:"number" url:"number,key"` // process number, e.g. 1 in web.1
4048 PrivateIP string `json:"private_ip" url:"private_ip,key"` // RFC1918 Address of Dyno
4049 } `json:"dynos" url:"dynos,key"` // Current dynos for application
4050 ID string `json:"id" url:"id,key"` // unique identifier of this process type
4051 ProcessType string `json:"process_type" url:"process_type,key"` // Name of process type
4052 } `json:"formation" url:"formation,key"` // formations for application
4053 ID string `json:"id" url:"id,key"` // unique identifier of app
4054 } `json:"apps" url:"apps,key"` // The apps within this space
4055 Version int `json:"version" url:"version,key"` // version of the space topology payload
4056 }
4057
4058 // Current space topology
4059 func (s *Service) SpaceTopologyTopology(ctx context.Context, spaceIdentity string) (*SpaceTopology, error) {
4060 var spaceTopology SpaceTopology
4061 return &spaceTopology, s.Get(ctx, &spaceTopology, fmt.Sprintf("/spaces/%v/topology", spaceIdentity), nil, nil)
4062 }
4063
4064 // Transfer spaces between enterprise teams with the same Enterprise
4065 // Account.
4066 type SpaceTransfer struct{}
4067 type SpaceTransferTransferOpts struct {
4068 NewOwner string `json:"new_owner" url:"new_owner,key"` // unique name of team
4069 }
4070 type SpaceTransferTransferResult struct {
4071 CIDR string `json:"cidr" url:"cidr,key"` // The RFC-1918 CIDR the Private Space will use. It must be a /16 in
4072 // 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16
4073 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when space was created
4074 DataCIDR string `json:"data_cidr" url:"data_cidr,key"` // The RFC-1918 CIDR that the Private Space will use for the
4075 // Heroku-managed peering connection that's automatically created when
4076 // using Heroku Data add-ons. It must be between a /16 and a /20
4077 ID string `json:"id" url:"id,key"` // unique identifier of space
4078 Name string `json:"name" url:"name,key"` // unique name of space
4079 Organization struct {
4080 Name string `json:"name" url:"name,key"` // unique name of team
4081 } `json:"organization" url:"organization,key"` // organization that owns this space
4082 Region struct {
4083 ID string `json:"id" url:"id,key"` // unique identifier of region
4084 Name string `json:"name" url:"name,key"` // unique name of region
4085 } `json:"region" url:"region,key"` // identity of space region
4086 Shield bool `json:"shield" url:"shield,key"` // true if this space has shield enabled
4087 State string `json:"state" url:"state,key"` // availability of this space
4088 Team struct {
4089 ID string `json:"id" url:"id,key"` // unique identifier of team
4090 Name string `json:"name" url:"name,key"` // unique name of team
4091 } `json:"team" url:"team,key"` // team that owns this space
4092 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when space was updated
4093 }
4094
4095 // Transfer space between enterprise teams
4096 func (s *Service) SpaceTransferTransfer(ctx context.Context, spaceIdentity string, o SpaceTransferTransferOpts) (*SpaceTransferTransferResult, error) {
4097 var spaceTransfer SpaceTransferTransferResult
4098 return &spaceTransfer, s.Post(ctx, &spaceTransfer, fmt.Sprintf("/spaces/%v/transfer", spaceIdentity), o)
4099 }
4100
4101 // Stacks are the different application execution environments available
4102 // in the Heroku platform.
4103 type Stack struct {
4104 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when stack was introduced
4105 Default bool `json:"default" url:"default,key"` // indicates this stack is the default for new apps
4106 ID string `json:"id" url:"id,key"` // unique identifier of stack
4107 Name string `json:"name" url:"name,key"` // unique name of stack
4108 State string `json:"state" url:"state,key"` // availability of this stack: beta, deprecated or public
4109 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when stack was last modified
4110 }
4111
4112 // Stack info.
4113 func (s *Service) StackInfo(ctx context.Context, stackIdentity string) (*Stack, error) {
4114 var stack Stack
4115 return &stack, s.Get(ctx, &stack, fmt.Sprintf("/stacks/%v", stackIdentity), nil, nil)
4116 }
4117
4118 type StackListResult []Stack
4119
4120 // List available stacks.
4121 func (s *Service) StackList(ctx context.Context, lr *ListRange) (StackListResult, error) {
4122 var stack StackListResult
4123 return stack, s.Get(ctx, &stack, fmt.Sprintf("/stacks"), nil, lr)
4124 }
4125
4126 // Teams allow you to manage access to a shared group of applications
4127 // and other resources.
4128 type Team struct {
4129 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the team was created
4130 CreditCardCollections bool `json:"credit_card_collections" url:"credit_card_collections,key"` // whether charges incurred by the team are paid by credit card.
4131 Default bool `json:"default" url:"default,key"` // whether to use this team when none is specified
4132 EnterpriseAccount *struct {
4133 ID string `json:"id" url:"id,key"` // unique identifier of the enterprise account
4134 Name string `json:"name" url:"name,key"` // unique name of the enterprise account
4135 } `json:"enterprise_account" url:"enterprise_account,key"`
4136 ID string `json:"id" url:"id,key"` // unique identifier of team
4137 IdentityProvider *struct {
4138 ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
4139 Name string `json:"name" url:"name,key"` // user-friendly unique identifier for this identity provider
4140 Owner struct {
4141 ID string `json:"id" url:"id,key"` // unique identifier of the owner
4142 Name string `json:"name" url:"name,key"` // name of the owner
4143 Type string `json:"type" url:"type,key"` // type of the owner
4144 } `json:"owner" url:"owner,key"` // entity that owns this identity provider
4145 } `json:"identity_provider" url:"identity_provider,key"` // Identity Provider associated with the Team
4146 MembershipLimit *float64 `json:"membership_limit" url:"membership_limit,key"` // upper limit of members allowed in a team.
4147 Name string `json:"name" url:"name,key"` // unique name of team
4148 ProvisionedLicenses bool `json:"provisioned_licenses" url:"provisioned_licenses,key"` // whether the team is provisioned licenses by salesforce.
4149 Role *string `json:"role" url:"role,key"` // role in the team
4150 Type string `json:"type" url:"type,key"` // type of team.
4151 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the team was updated
4152 }
4153 type TeamListResult []Team
4154
4155 // List teams in which you are a member.
4156 func (s *Service) TeamList(ctx context.Context, lr *ListRange) (TeamListResult, error) {
4157 var team TeamListResult
4158 return team, s.Get(ctx, &team, fmt.Sprintf("/teams"), nil, lr)
4159 }
4160
4161 // Info for a team.
4162 func (s *Service) TeamInfo(ctx context.Context, teamIdentity string) (*Team, error) {
4163 var team Team
4164 return &team, s.Get(ctx, &team, fmt.Sprintf("/teams/%v", teamIdentity), nil, nil)
4165 }
4166
4167 type TeamUpdateOpts struct {
4168 Default *bool `json:"default,omitempty" url:"default,omitempty,key"` // whether to use this team when none is specified
4169 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of team
4170 }
4171
4172 // Update team properties.
4173 func (s *Service) TeamUpdate(ctx context.Context, teamIdentity string, o TeamUpdateOpts) (*Team, error) {
4174 var team Team
4175 return &team, s.Patch(ctx, &team, fmt.Sprintf("/teams/%v", teamIdentity), o)
4176 }
4177
4178 type TeamCreateOpts struct {
4179 Address1 *string `json:"address_1,omitempty" url:"address_1,omitempty,key"` // street address line 1
4180 Address2 *string `json:"address_2,omitempty" url:"address_2,omitempty,key"` // street address line 2
4181 CardNumber *string `json:"card_number,omitempty" url:"card_number,omitempty,key"` // encrypted card number of payment method
4182 City *string `json:"city,omitempty" url:"city,omitempty,key"` // city
4183 Country *string `json:"country,omitempty" url:"country,omitempty,key"` // country
4184 Cvv *string `json:"cvv,omitempty" url:"cvv,omitempty,key"` // card verification value
4185 DeviceData *string `json:"device_data,omitempty" url:"device_data,omitempty,key"` // Device data string generated by the client
4186 ExpirationMonth *string `json:"expiration_month,omitempty" url:"expiration_month,omitempty,key"` // expiration month
4187 ExpirationYear *string `json:"expiration_year,omitempty" url:"expiration_year,omitempty,key"` // expiration year
4188 FirstName *string `json:"first_name,omitempty" url:"first_name,omitempty,key"` // the first name for payment method
4189 LastName *string `json:"last_name,omitempty" url:"last_name,omitempty,key"` // the last name for payment method
4190 Name string `json:"name" url:"name,key"` // unique name of team
4191 Nonce *string `json:"nonce,omitempty" url:"nonce,omitempty,key"` // Nonce generated by Braintree hosted fields form
4192 Other *string `json:"other,omitempty" url:"other,omitempty,key"` // metadata
4193 PostalCode *string `json:"postal_code,omitempty" url:"postal_code,omitempty,key"` // postal code
4194 State *string `json:"state,omitempty" url:"state,omitempty,key"` // state
4195 }
4196
4197 // Create a new team.
4198 func (s *Service) TeamCreate(ctx context.Context, o TeamCreateOpts) (*Team, error) {
4199 var team Team
4200 return &team, s.Post(ctx, &team, fmt.Sprintf("/teams"), o)
4201 }
4202
4203 // Delete an existing team.
4204 func (s *Service) TeamDelete(ctx context.Context, teamIdentity string) (*Team, error) {
4205 var team Team
4206 return &team, s.Delete(ctx, &team, fmt.Sprintf("/teams/%v", teamIdentity))
4207 }
4208
4209 type TeamListByEnterpriseAccountResult []Team
4210
4211 // List teams for an enterprise account.
4212 func (s *Service) TeamListByEnterpriseAccount(ctx context.Context, enterpriseAccountIdentity string, lr *ListRange) (TeamListByEnterpriseAccountResult, error) {
4213 var team TeamListByEnterpriseAccountResult
4214 return team, s.Get(ctx, &team, fmt.Sprintf("/enterprise-accounts/%v/teams", enterpriseAccountIdentity), nil, lr)
4215 }
4216
4217 type TeamCreateInEnterpriseAccountOpts struct {
4218 Name string `json:"name" url:"name,key"` // unique name of team
4219 }
4220
4221 // Create a team in an enterprise account.
4222 func (s *Service) TeamCreateInEnterpriseAccount(ctx context.Context, enterpriseAccountIdentity string, o TeamCreateInEnterpriseAccountOpts) (*Team, error) {
4223 var team Team
4224 return &team, s.Post(ctx, &team, fmt.Sprintf("/enterprise-accounts/%v/teams", enterpriseAccountIdentity), o)
4225 }
4226
4227 type TeamAddOn struct{}
4228 type TeamAddOnListForTeamResult []struct {
4229 Actions []struct{} `json:"actions" url:"actions,key"` // provider actions for this specific add-on
4230 AddonService struct {
4231 ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
4232 Name string `json:"name" url:"name,key"` // unique name of this add-on-service
4233 } `json:"addon_service" url:"addon_service,key"` // identity of add-on service
4234 App struct {
4235 ID string `json:"id" url:"id,key"` // unique identifier of app
4236 Name string `json:"name" url:"name,key"` // unique name of app
4237 } `json:"app" url:"app,key"` // billing application associated with this add-on
4238 BilledPrice *struct {
4239 Cents int `json:"cents" url:"cents,key"` // price in cents per unit of plan
4240 Contract bool `json:"contract" url:"contract,key"` // price is negotiated in a contract outside of monthly add-on billing
4241 Unit string `json:"unit" url:"unit,key"` // unit of price for plan
4242 } `json:"billed_price" url:"billed_price,key"` // billed price
4243 BillingEntity struct {
4244 ID string `json:"id" url:"id,key"` // unique identifier of the billing entity
4245 Name string `json:"name" url:"name,key"` // name of the billing entity
4246 Type string `json:"type" url:"type,key"` // type of Object of the billing entity; new types allowed at any time.
4247 } `json:"billing_entity" url:"billing_entity,key"` // billing entity associated with this add-on
4248 ConfigVars []string `json:"config_vars" url:"config_vars,key"` // config vars exposed to the owning app by this add-on
4249 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on was created
4250 ID string `json:"id" url:"id,key"` // unique identifier of add-on
4251 Name string `json:"name" url:"name,key"` // globally unique name of the add-on
4252 Plan struct {
4253 ID string `json:"id" url:"id,key"` // unique identifier of this plan
4254 Name string `json:"name" url:"name,key"` // unique name of this plan
4255 } `json:"plan" url:"plan,key"` // identity of add-on plan
4256 ProviderID string `json:"provider_id" url:"provider_id,key"` // id of this add-on with its provider
4257 State string `json:"state" url:"state,key"` // state in the add-on's lifecycle
4258 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on was updated
4259 WebURL *string `json:"web_url" url:"web_url,key"` // URL for logging into web interface of add-on (e.g. a dashboard)
4260 }
4261
4262 // List add-ons used across all Team apps
4263 func (s *Service) TeamAddOnListForTeam(ctx context.Context, teamIdentity string, lr *ListRange) (TeamAddOnListForTeamResult, error) {
4264 var teamAddOn TeamAddOnListForTeamResult
4265 return teamAddOn, s.Get(ctx, &teamAddOn, fmt.Sprintf("/teams/%v/addons", teamIdentity), nil, lr)
4266 }
4267
4268 // A team app encapsulates the team specific functionality of Heroku
4269 // apps.
4270 type TeamApp struct {
4271 ArchivedAt *time.Time `json:"archived_at" url:"archived_at,key"` // when app was archived
4272 BuildStack struct {
4273 ID string `json:"id" url:"id,key"` // unique identifier of stack
4274 Name string `json:"name" url:"name,key"` // unique name of stack
4275 } `json:"build_stack" url:"build_stack,key"` // identity of the stack that will be used for new builds
4276 BuildpackProvidedDescription *string `json:"buildpack_provided_description" url:"buildpack_provided_description,key"` // description from buildpack of app
4277 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app was created
4278 GitURL string `json:"git_url" url:"git_url,key"` // git repo URL of app
4279 ID string `json:"id" url:"id,key"` // unique identifier of app
4280 InternalRouting *bool `json:"internal_routing" url:"internal_routing,key"` // describes whether a Private Spaces app is externally routable or not
4281 Joined bool `json:"joined" url:"joined,key"` // is the current member a collaborator on this app.
4282 Locked bool `json:"locked" url:"locked,key"` // are other team members forbidden from joining this app.
4283 Maintenance bool `json:"maintenance" url:"maintenance,key"` // maintenance status of app
4284 Name string `json:"name" url:"name,key"` // unique name of app
4285 Owner *struct {
4286 Email string `json:"email" url:"email,key"` // unique email address of account
4287 ID string `json:"id" url:"id,key"` // unique identifier of an account
4288 } `json:"owner" url:"owner,key"` // identity of app owner
4289 Region struct {
4290 ID string `json:"id" url:"id,key"` // unique identifier of region
4291 Name string `json:"name" url:"name,key"` // unique name of region
4292 } `json:"region" url:"region,key"` // identity of app region
4293 ReleasedAt *time.Time `json:"released_at" url:"released_at,key"` // when app was released
4294 RepoSize *int `json:"repo_size" url:"repo_size,key"` // git repo size in bytes of app
4295 SlugSize *int `json:"slug_size" url:"slug_size,key"` // slug size in bytes of app
4296 Space *struct {
4297 ID string `json:"id" url:"id,key"` // unique identifier of space
4298 Name string `json:"name" url:"name,key"` // unique name of space
4299 } `json:"space" url:"space,key"` // identity of space
4300 Stack struct {
4301 ID string `json:"id" url:"id,key"` // unique identifier of stack
4302 Name string `json:"name" url:"name,key"` // unique name of stack
4303 } `json:"stack" url:"stack,key"` // identity of app stack
4304 Team *struct {
4305 Name string `json:"name" url:"name,key"` // unique name of team
4306 } `json:"team" url:"team,key"` // team that owns this app
4307 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app was updated
4308 WebURL string `json:"web_url" url:"web_url,key"` // web URL of app
4309 }
4310 type TeamAppCreateOpts struct {
4311 InternalRouting *bool `json:"internal_routing,omitempty" url:"internal_routing,omitempty,key"` // describes whether a Private Spaces app is externally routable or not
4312 Locked *bool `json:"locked,omitempty" url:"locked,omitempty,key"` // are other team members forbidden from joining this app.
4313 Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of app
4314 Personal *bool `json:"personal,omitempty" url:"personal,omitempty,key"` // force creation of the app in the user account even if a default team
4315 // is set.
4316 Region *string `json:"region,omitempty" url:"region,omitempty,key"` // unique name of region
4317 Space *string `json:"space,omitempty" url:"space,omitempty,key"` // unique name of space
4318 Stack *string `json:"stack,omitempty" url:"stack,omitempty,key"` // unique name of stack
4319 Team *string `json:"team,omitempty" url:"team,omitempty,key"` // unique name of team
4320 }
4321
4322 // Create a new app in the specified team, in the default team if
4323 // unspecified, or in personal account, if default team is not set.
4324 func (s *Service) TeamAppCreate(ctx context.Context, o TeamAppCreateOpts) (*TeamApp, error) {
4325 var teamApp TeamApp
4326 return &teamApp, s.Post(ctx, &teamApp, fmt.Sprintf("/teams/apps"), o)
4327 }
4328
4329 // Info for a team app.
4330 func (s *Service) TeamAppInfo(ctx context.Context, teamAppIdentity string) (*TeamApp, error) {
4331 var teamApp TeamApp
4332 return &teamApp, s.Get(ctx, &teamApp, fmt.Sprintf("/teams/apps/%v", teamAppIdentity), nil, nil)
4333 }
4334
4335 type TeamAppUpdateLockedOpts struct {
4336 Locked bool `json:"locked" url:"locked,key"` // are other team members forbidden from joining this app.
4337 }
4338
4339 // Lock or unlock a team app.
4340 func (s *Service) TeamAppUpdateLocked(ctx context.Context, teamAppIdentity string, o TeamAppUpdateLockedOpts) (*TeamApp, error) {
4341 var teamApp TeamApp
4342 return &teamApp, s.Patch(ctx, &teamApp, fmt.Sprintf("/teams/apps/%v", teamAppIdentity), o)
4343 }
4344
4345 type TeamAppTransferToAccountOpts struct {
4346 Owner string `json:"owner" url:"owner,key"` // unique email address of account
4347 }
4348
4349 // Transfer an existing team app to another Heroku account.
4350 func (s *Service) TeamAppTransferToAccount(ctx context.Context, teamAppIdentity string, o TeamAppTransferToAccountOpts) (*TeamApp, error) {
4351 var teamApp TeamApp
4352 return &teamApp, s.Patch(ctx, &teamApp, fmt.Sprintf("/teams/apps/%v", teamAppIdentity), o)
4353 }
4354
4355 type TeamAppTransferToTeamOpts struct {
4356 Owner string `json:"owner" url:"owner,key"` // unique name of team
4357 }
4358
4359 // Transfer an existing team app to another team.
4360 func (s *Service) TeamAppTransferToTeam(ctx context.Context, teamAppIdentity string, o TeamAppTransferToTeamOpts) (*TeamApp, error) {
4361 var teamApp TeamApp
4362 return &teamApp, s.Patch(ctx, &teamApp, fmt.Sprintf("/teams/apps/%v", teamAppIdentity), o)
4363 }
4364
4365 type TeamAppListByTeamResult []TeamApp
4366
4367 // List team apps.
4368 func (s *Service) TeamAppListByTeam(ctx context.Context, teamIdentity string, lr *ListRange) (TeamAppListByTeamResult, error) {
4369 var teamApp TeamAppListByTeamResult
4370 return teamApp, s.Get(ctx, &teamApp, fmt.Sprintf("/teams/%v/apps", teamIdentity), nil, lr)
4371 }
4372
4373 // A team collaborator represents an account that has been given access
4374 // to a team app on Heroku.
4375 type TeamAppCollaborator struct {
4376 App struct {
4377 ID string `json:"id" url:"id,key"` // unique identifier of app
4378 Name string `json:"name" url:"name,key"` // unique name of app
4379 } `json:"app" url:"app,key"` // app collaborator belongs to
4380 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when collaborator was created
4381 ID string `json:"id" url:"id,key"` // unique identifier of collaborator
4382 Permissions []struct {
4383 Description string `json:"description" url:"description,key"` // A description of what the app permission allows.
4384 Name string `json:"name" url:"name,key"` // The name of the app permission.
4385 } `json:"permissions" url:"permissions,key"` // array of permissions for the collaborator (only applicable if the app
4386 // is on a team)
4387 Role *string `json:"role" url:"role,key"` // role in the team
4388 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when collaborator was updated
4389 User struct {
4390 Email string `json:"email" url:"email,key"` // unique email address of account
4391 Federated bool `json:"federated" url:"federated,key"` // whether the user is federated and belongs to an Identity Provider
4392 ID string `json:"id" url:"id,key"` // unique identifier of an account
4393 } `json:"user" url:"user,key"` // identity of collaborated account
4394 }
4395 type TeamAppCollaboratorCreateOpts struct {
4396 Permissions []*string `json:"permissions,omitempty" url:"permissions,omitempty,key"` // An array of permissions to give to the collaborator.
4397 Silent *bool `json:"silent,omitempty" url:"silent,omitempty,key"` // whether to suppress email invitation when creating collaborator
4398 User string `json:"user" url:"user,key"` // unique email address of account
4399 }
4400
4401 // Create a new collaborator on a team app. Use this endpoint instead of
4402 // the `/apps/{app_id_or_name}/collaborator` endpoint when you want the
4403 // collaborator to be granted [permissions]
4404 // (https://devcenter.heroku.com/articles/org-users-access#roles-and-perm
4405 // issions) according to their role in the team.
4406 func (s *Service) TeamAppCollaboratorCreate(ctx context.Context, appIdentity string, o TeamAppCollaboratorCreateOpts) (*TeamAppCollaborator, error) {
4407 var teamAppCollaborator TeamAppCollaborator
4408 return &teamAppCollaborator, s.Post(ctx, &teamAppCollaborator, fmt.Sprintf("/teams/apps/%v/collaborators", appIdentity), o)
4409 }
4410
4411 // Delete an existing collaborator from a team app.
4412 func (s *Service) TeamAppCollaboratorDelete(ctx context.Context, teamAppIdentity string, teamAppCollaboratorIdentity string) (*TeamAppCollaborator, error) {
4413 var teamAppCollaborator TeamAppCollaborator
4414 return &teamAppCollaborator, s.Delete(ctx, &teamAppCollaborator, fmt.Sprintf("/teams/apps/%v/collaborators/%v", teamAppIdentity, teamAppCollaboratorIdentity))
4415 }
4416
4417 // Info for a collaborator on a team app.
4418 func (s *Service) TeamAppCollaboratorInfo(ctx context.Context, teamAppIdentity string, teamAppCollaboratorIdentity string) (*TeamAppCollaborator, error) {
4419 var teamAppCollaborator TeamAppCollaborator
4420 return &teamAppCollaborator, s.Get(ctx, &teamAppCollaborator, fmt.Sprintf("/teams/apps/%v/collaborators/%v", teamAppIdentity, teamAppCollaboratorIdentity), nil, nil)
4421 }
4422
4423 type TeamAppCollaboratorUpdateOpts struct {
4424 Permissions []string `json:"permissions" url:"permissions,key"` // An array of permissions to give to the collaborator.
4425 }
4426
4427 // Update an existing collaborator from a team app.
4428 func (s *Service) TeamAppCollaboratorUpdate(ctx context.Context, teamAppIdentity string, teamAppCollaboratorIdentity string, o TeamAppCollaboratorUpdateOpts) (*TeamAppCollaborator, error) {
4429 var teamAppCollaborator TeamAppCollaborator
4430 return &teamAppCollaborator, s.Patch(ctx, &teamAppCollaborator, fmt.Sprintf("/teams/apps/%v/collaborators/%v", teamAppIdentity, teamAppCollaboratorIdentity), o)
4431 }
4432
4433 type TeamAppCollaboratorListResult []TeamAppCollaborator
4434
4435 // List collaborators on a team app.
4436 func (s *Service) TeamAppCollaboratorList(ctx context.Context, teamAppIdentity string, lr *ListRange) (TeamAppCollaboratorListResult, error) {
4437 var teamAppCollaborator TeamAppCollaboratorListResult
4438 return teamAppCollaborator, s.Get(ctx, &teamAppCollaborator, fmt.Sprintf("/teams/apps/%v/collaborators", teamAppIdentity), nil, lr)
4439 }
4440
4441 // A team app permission is a behavior that is assigned to a user in a
4442 // team app.
4443 type TeamAppPermission struct {
4444 Description string `json:"description" url:"description,key"` // A description of what the app permission allows.
4445 Name string `json:"name" url:"name,key"` // The name of the app permission.
4446 }
4447 type TeamAppPermissionListResult []TeamAppPermission
4448
4449 // Lists permissions available to teams.
4450 func (s *Service) TeamAppPermissionList(ctx context.Context, lr *ListRange) (TeamAppPermissionListResult, error) {
4451 var teamAppPermission TeamAppPermissionListResult
4452 return teamAppPermission, s.Get(ctx, &teamAppPermission, fmt.Sprintf("/teams/permissions"), nil, lr)
4453 }
4454
4455 // Usage for an enterprise team at a daily resolution.
4456 type TeamDailyUsage struct {
4457 Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
4458 Apps []struct {
4459 Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
4460 AppName string `json:"app_name" url:"app_name,key"` // unique name of app
4461 Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
4462 Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
4463 Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
4464 } `json:"apps" url:"apps,key"` // app usage in the team
4465 Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
4466 Date string `json:"date" url:"date,key"` // date of the usage
4467 Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
4468 ID string `json:"id" url:"id,key"` // team identifier
4469 Name string `json:"name" url:"name,key"` // name of the team
4470 Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
4471 Space float64 `json:"space" url:"space,key"` // space credits used
4472 }
4473 type TeamDailyUsageInfoOpts struct {
4474 End *string `json:"end,omitempty" url:"end,omitempty,key"` // range end date
4475 Start string `json:"start" url:"start,key"` // range start date
4476 }
4477 type TeamDailyUsageInfoResult []TeamDailyUsage
4478
4479 // Retrieves usage for an enterprise team for a range of days. Start and
4480 // end dates can be specified as query parameters using the date format
4481 // YYYY-MM-DD. The team identifier can be found from the [team list
4482 // endpoint](https://devcenter.heroku.com/articles/platform-api-reference
4483 // #team-list).
4484 //
4485 func (s *Service) TeamDailyUsageInfo(ctx context.Context, teamID string, o TeamDailyUsageInfoOpts, lr *ListRange) (TeamDailyUsageInfoResult, error) {
4486 var teamDailyUsage TeamDailyUsageInfoResult
4487 return teamDailyUsage, s.Get(ctx, &teamDailyUsage, fmt.Sprintf("/teams/%v/usage/daily", teamID), o, lr)
4488 }
4489
4490 // A team feature represents a feature enabled on a team account.
4491 type TeamFeature struct {
4492 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when team feature was created
4493 Description string `json:"description" url:"description,key"` // description of team feature
4494 DisplayName string `json:"display_name" url:"display_name,key"` // user readable feature name
4495 DocURL string `json:"doc_url" url:"doc_url,key"` // documentation URL of team feature
4496 Enabled bool `json:"enabled" url:"enabled,key"` // whether or not team feature has been enabled
4497 FeedbackEmail string `json:"feedback_email" url:"feedback_email,key"` // e-mail to send feedback about the feature
4498 ID string `json:"id" url:"id,key"` // unique identifier of team feature
4499 Name string `json:"name" url:"name,key"` // unique name of team feature
4500 State string `json:"state" url:"state,key"` // state of team feature
4501 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when team feature was updated
4502 }
4503
4504 // Info for an existing team feature.
4505 func (s *Service) TeamFeatureInfo(ctx context.Context, teamIdentity string, teamFeatureIdentity string) (*TeamFeature, error) {
4506 var teamFeature TeamFeature
4507 return &teamFeature, s.Get(ctx, &teamFeature, fmt.Sprintf("/teams/%v/features/%v", teamIdentity, teamFeatureIdentity), nil, nil)
4508 }
4509
4510 type TeamFeatureListResult []TeamFeature
4511
4512 // List existing team features.
4513 func (s *Service) TeamFeatureList(ctx context.Context, teamIdentity string, lr *ListRange) (TeamFeatureListResult, error) {
4514 var teamFeature TeamFeatureListResult
4515 return teamFeature, s.Get(ctx, &teamFeature, fmt.Sprintf("/teams/%v/features", teamIdentity), nil, lr)
4516 }
4517
4518 // A team invitation represents an invite to a team.
4519 type TeamInvitation struct {
4520 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when invitation was created
4521 ID string `json:"id" url:"id,key"` // unique identifier of an invitation
4522 InvitedBy struct {
4523 Email string `json:"email" url:"email,key"` // unique email address of account
4524 ID string `json:"id" url:"id,key"` // unique identifier of an account
4525 Name *string `json:"name" url:"name,key"` // full name of the account owner
4526 } `json:"invited_by" url:"invited_by,key"`
4527 Role *string `json:"role" url:"role,key"` // role in the team
4528 Team struct {
4529 ID string `json:"id" url:"id,key"` // unique identifier of team
4530 Name string `json:"name" url:"name,key"` // unique name of team
4531 } `json:"team" url:"team,key"`
4532 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when invitation was updated
4533 User struct {
4534 Email string `json:"email" url:"email,key"` // unique email address of account
4535 ID string `json:"id" url:"id,key"` // unique identifier of an account
4536 Name *string `json:"name" url:"name,key"` // full name of the account owner
4537 } `json:"user" url:"user,key"`
4538 }
4539 type TeamInvitationListResult []TeamInvitation
4540
4541 // Get a list of a team's Identity Providers
4542 func (s *Service) TeamInvitationList(ctx context.Context, teamName string, lr *ListRange) (TeamInvitationListResult, error) {
4543 var teamInvitation TeamInvitationListResult
4544 return teamInvitation, s.Get(ctx, &teamInvitation, fmt.Sprintf("/teams/%v/invitations", teamName), nil, lr)
4545 }
4546
4547 type TeamInvitationCreateOpts struct {
4548 Email string `json:"email" url:"email,key"` // unique email address of account
4549 Role *string `json:"role" url:"role,key"` // role in the team
4550 }
4551
4552 // Create Team Invitation
4553 func (s *Service) TeamInvitationCreate(ctx context.Context, teamIdentity string, o TeamInvitationCreateOpts) (*TeamInvitation, error) {
4554 var teamInvitation TeamInvitation
4555 return &teamInvitation, s.Put(ctx, &teamInvitation, fmt.Sprintf("/teams/%v/invitations", teamIdentity), o)
4556 }
4557
4558 // Revoke a team invitation.
4559 func (s *Service) TeamInvitationRevoke(ctx context.Context, teamIdentity string, teamInvitationIdentity string) (*TeamInvitation, error) {
4560 var teamInvitation TeamInvitation
4561 return &teamInvitation, s.Delete(ctx, &teamInvitation, fmt.Sprintf("/teams/%v/invitations/%v", teamIdentity, teamInvitationIdentity))
4562 }
4563
4564 // Get an invitation by its token
4565 func (s *Service) TeamInvitationGet(ctx context.Context, teamInvitationToken string, lr *ListRange) (*TeamInvitation, error) {
4566 var teamInvitation TeamInvitation
4567 return &teamInvitation, s.Get(ctx, &teamInvitation, fmt.Sprintf("/teams/invitations/%v", teamInvitationToken), nil, lr)
4568 }
4569
4570 type TeamInvitationAcceptResult struct {
4571 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the membership record was created
4572 Email string `json:"email" url:"email,key"` // email address of the team member
4573 Federated bool `json:"federated" url:"federated,key"` // whether the user is federated and belongs to an Identity Provider
4574 ID string `json:"id" url:"id,key"` // unique identifier of the team member
4575 IdentityProvider *struct {
4576 ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
4577 Name string `json:"name" url:"name,key"` // name of the identity provider
4578 Owner struct {
4579 ID string `json:"id" url:"id,key"` // unique identifier of the owner
4580 Name string `json:"name" url:"name,key"` // name of the owner
4581 Type string `json:"type" url:"type,key"` // type of the owner
4582 } `json:"owner" url:"owner,key"` // entity that owns this identity provider
4583 Redacted bool `json:"redacted" url:"redacted,key"` // whether the identity_provider information is redacted or not
4584 } `json:"identity_provider" url:"identity_provider,key"` // Identity Provider information the member is federated with
4585 Role *string `json:"role" url:"role,key"` // role in the team
4586 TwoFactorAuthentication bool `json:"two_factor_authentication" url:"two_factor_authentication,key"` // whether the Enterprise team member has two factor authentication
4587 // enabled
4588 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the membership record was updated
4589 User struct {
4590 Email string `json:"email" url:"email,key"` // unique email address of account
4591 ID string `json:"id" url:"id,key"` // unique identifier of an account
4592 Name *string `json:"name" url:"name,key"` // full name of the account owner
4593 } `json:"user" url:"user,key"` // user information for the membership
4594 }
4595
4596 // Accept Team Invitation
4597 func (s *Service) TeamInvitationAccept(ctx context.Context, teamInvitationToken string) (*TeamInvitationAcceptResult, error) {
4598 var teamInvitation TeamInvitationAcceptResult
4599 return &teamInvitation, s.Post(ctx, &teamInvitation, fmt.Sprintf("/teams/invitations/%v/accept", teamInvitationToken), nil)
4600 }
4601
4602 // A Team Invoice is an itemized bill of goods for a team which includes
4603 // pricing and charges.
4604 type TeamInvoice struct {
4605 AddonsTotal int `json:"addons_total" url:"addons_total,key"` // total add-ons charges in on this invoice
4606 ChargesTotal int `json:"charges_total" url:"charges_total,key"` // total charges on this invoice
4607 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when invoice was created
4608 CreditsTotal int `json:"credits_total" url:"credits_total,key"` // total credits on this invoice
4609 DatabaseTotal int `json:"database_total" url:"database_total,key"` // total database charges on this invoice
4610 DynoUnits float64 `json:"dyno_units" url:"dyno_units,key"` // total amount of dyno units consumed across dyno types.
4611 ID string `json:"id" url:"id,key"` // unique identifier of this invoice
4612 Number int `json:"number" url:"number,key"` // human readable invoice number
4613 PaymentStatus string `json:"payment_status" url:"payment_status,key"` // status of the invoice payment
4614 PeriodEnd string `json:"period_end" url:"period_end,key"` // the ending date that the invoice covers
4615 PeriodStart string `json:"period_start" url:"period_start,key"` // the starting date that this invoice covers
4616 PlatformTotal int `json:"platform_total" url:"platform_total,key"` // total platform charges on this invoice
4617 State int `json:"state" url:"state,key"` // payment status for this invoice (pending, successful, failed)
4618 Total int `json:"total" url:"total,key"` // combined total of charges and credits on this invoice
4619 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when invoice was updated
4620 WeightedDynoHours float64 `json:"weighted_dyno_hours" url:"weighted_dyno_hours,key"` // The total amount of hours consumed across dyno types.
4621 }
4622
4623 // Info for existing invoice.
4624 func (s *Service) TeamInvoiceInfo(ctx context.Context, teamIdentity string, teamInvoiceIdentity int) (*TeamInvoice, error) {
4625 var teamInvoice TeamInvoice
4626 return &teamInvoice, s.Get(ctx, &teamInvoice, fmt.Sprintf("/teams/%v/invoices/%v", teamIdentity, teamInvoiceIdentity), nil, nil)
4627 }
4628
4629 type TeamInvoiceListResult []TeamInvoice
4630
4631 // List existing invoices.
4632 func (s *Service) TeamInvoiceList(ctx context.Context, teamIdentity string, lr *ListRange) (TeamInvoiceListResult, error) {
4633 var teamInvoice TeamInvoiceListResult
4634 return teamInvoice, s.Get(ctx, &teamInvoice, fmt.Sprintf("/teams/%v/invoices", teamIdentity), nil, lr)
4635 }
4636
4637 // A team member is an individual with access to a team.
4638 type TeamMember struct {
4639 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the membership record was created
4640 Email string `json:"email" url:"email,key"` // email address of the team member
4641 Federated bool `json:"federated" url:"federated,key"` // whether the user is federated and belongs to an Identity Provider
4642 ID string `json:"id" url:"id,key"` // unique identifier of the team member
4643 IdentityProvider *struct {
4644 ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
4645 Name string `json:"name" url:"name,key"` // name of the identity provider
4646 Owner struct {
4647 ID string `json:"id" url:"id,key"` // unique identifier of the owner
4648 Name string `json:"name" url:"name,key"` // name of the owner
4649 Type string `json:"type" url:"type,key"` // type of the owner
4650 } `json:"owner" url:"owner,key"` // entity that owns this identity provider
4651 Redacted bool `json:"redacted" url:"redacted,key"` // whether the identity_provider information is redacted or not
4652 } `json:"identity_provider" url:"identity_provider,key"` // Identity Provider information the member is federated with
4653 Role *string `json:"role" url:"role,key"` // role in the team
4654 TwoFactorAuthentication bool `json:"two_factor_authentication" url:"two_factor_authentication,key"` // whether the Enterprise team member has two factor authentication
4655 // enabled
4656 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the membership record was updated
4657 User struct {
4658 Email string `json:"email" url:"email,key"` // unique email address of account
4659 ID string `json:"id" url:"id,key"` // unique identifier of an account
4660 Name *string `json:"name" url:"name,key"` // full name of the account owner
4661 } `json:"user" url:"user,key"` // user information for the membership
4662 }
4663 type TeamMemberCreateOrUpdateOpts struct {
4664 Email string `json:"email" url:"email,key"` // email address of the team member
4665 Federated *bool `json:"federated,omitempty" url:"federated,omitempty,key"` // whether the user is federated and belongs to an Identity Provider
4666 Role string `json:"role" url:"role,key"` // role in the team
4667 }
4668
4669 // Create a new team member, or update their role.
4670 func (s *Service) TeamMemberCreateOrUpdate(ctx context.Context, teamIdentity string, o TeamMemberCreateOrUpdateOpts) (*TeamMember, error) {
4671 var teamMember TeamMember
4672 return &teamMember, s.Put(ctx, &teamMember, fmt.Sprintf("/teams/%v/members", teamIdentity), o)
4673 }
4674
4675 type TeamMemberCreateOpts struct {
4676 Email string `json:"email" url:"email,key"` // email address of the team member
4677 Federated *bool `json:"federated,omitempty" url:"federated,omitempty,key"` // whether the user is federated and belongs to an Identity Provider
4678 Role string `json:"role" url:"role,key"` // role in the team
4679 }
4680
4681 // Create a new team member.
4682 func (s *Service) TeamMemberCreate(ctx context.Context, teamIdentity string, o TeamMemberCreateOpts) (*TeamMember, error) {
4683 var teamMember TeamMember
4684 return &teamMember, s.Post(ctx, &teamMember, fmt.Sprintf("/teams/%v/members", teamIdentity), o)
4685 }
4686
4687 type TeamMemberUpdateOpts struct {
4688 Email string `json:"email" url:"email,key"` // email address of the team member
4689 Federated *bool `json:"federated,omitempty" url:"federated,omitempty,key"` // whether the user is federated and belongs to an Identity Provider
4690 Role string `json:"role" url:"role,key"` // role in the team
4691 }
4692
4693 // Update a team member.
4694 func (s *Service) TeamMemberUpdate(ctx context.Context, teamIdentity string, o TeamMemberUpdateOpts) (*TeamMember, error) {
4695 var teamMember TeamMember
4696 return &teamMember, s.Patch(ctx, &teamMember, fmt.Sprintf("/teams/%v/members", teamIdentity), o)
4697 }
4698
4699 // Remove a member from the team.
4700 func (s *Service) TeamMemberDelete(ctx context.Context, teamIdentity string, teamMemberIdentity string) (*TeamMember, error) {
4701 var teamMember TeamMember
4702 return &teamMember, s.Delete(ctx, &teamMember, fmt.Sprintf("/teams/%v/members/%v", teamIdentity, teamMemberIdentity))
4703 }
4704
4705 type TeamMemberListResult []TeamMember
4706
4707 // List members of the team.
4708 func (s *Service) TeamMemberList(ctx context.Context, teamIdentity string, lr *ListRange) (TeamMemberListResult, error) {
4709 var teamMember TeamMemberListResult
4710 return teamMember, s.Get(ctx, &teamMember, fmt.Sprintf("/teams/%v/members", teamIdentity), nil, lr)
4711 }
4712
4713 type TeamMemberListByMemberResult []struct {
4714 ArchivedAt *time.Time `json:"archived_at" url:"archived_at,key"` // when app was archived
4715 BuildStack struct {
4716 ID string `json:"id" url:"id,key"` // unique identifier of stack
4717 Name string `json:"name" url:"name,key"` // unique name of stack
4718 } `json:"build_stack" url:"build_stack,key"` // identity of the stack that will be used for new builds
4719 BuildpackProvidedDescription *string `json:"buildpack_provided_description" url:"buildpack_provided_description,key"` // description from buildpack of app
4720 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app was created
4721 GitURL string `json:"git_url" url:"git_url,key"` // git repo URL of app
4722 ID string `json:"id" url:"id,key"` // unique identifier of app
4723 InternalRouting *bool `json:"internal_routing" url:"internal_routing,key"` // describes whether a Private Spaces app is externally routable or not
4724 Joined bool `json:"joined" url:"joined,key"` // is the current member a collaborator on this app.
4725 Locked bool `json:"locked" url:"locked,key"` // are other team members forbidden from joining this app.
4726 Maintenance bool `json:"maintenance" url:"maintenance,key"` // maintenance status of app
4727 Name string `json:"name" url:"name,key"` // unique name of app
4728 Owner *struct {
4729 Email string `json:"email" url:"email,key"` // unique email address of account
4730 ID string `json:"id" url:"id,key"` // unique identifier of an account
4731 } `json:"owner" url:"owner,key"` // identity of app owner
4732 Region struct {
4733 ID string `json:"id" url:"id,key"` // unique identifier of region
4734 Name string `json:"name" url:"name,key"` // unique name of region
4735 } `json:"region" url:"region,key"` // identity of app region
4736 ReleasedAt *time.Time `json:"released_at" url:"released_at,key"` // when app was released
4737 RepoSize *int `json:"repo_size" url:"repo_size,key"` // git repo size in bytes of app
4738 SlugSize *int `json:"slug_size" url:"slug_size,key"` // slug size in bytes of app
4739 Space *struct {
4740 ID string `json:"id" url:"id,key"` // unique identifier of space
4741 Name string `json:"name" url:"name,key"` // unique name of space
4742 } `json:"space" url:"space,key"` // identity of space
4743 Stack struct {
4744 ID string `json:"id" url:"id,key"` // unique identifier of stack
4745 Name string `json:"name" url:"name,key"` // unique name of stack
4746 } `json:"stack" url:"stack,key"` // identity of app stack
4747 Team *struct {
4748 Name string `json:"name" url:"name,key"` // unique name of team
4749 } `json:"team" url:"team,key"` // team that owns this app
4750 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app was updated
4751 WebURL string `json:"web_url" url:"web_url,key"` // web URL of app
4752 }
4753
4754 // List the apps of a team member.
4755 func (s *Service) TeamMemberListByMember(ctx context.Context, teamIdentity string, teamMemberIdentity string, lr *ListRange) (TeamMemberListByMemberResult, error) {
4756 var teamMember TeamMemberListByMemberResult
4757 return teamMember, s.Get(ctx, &teamMember, fmt.Sprintf("/teams/%v/members/%v/apps", teamIdentity, teamMemberIdentity), nil, lr)
4758 }
4759
4760 // Usage for an enterprise team at a monthly resolution.
4761 type TeamMonthlyUsage struct {
4762 Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
4763 Apps []struct {
4764 Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
4765 AppName string `json:"app_name" url:"app_name,key"` // unique name of app
4766 Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
4767 Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
4768 Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
4769 } `json:"apps" url:"apps,key"` // app usage in the team
4770 Connect float64 `json:"connect" url:"connect,key"` // average connect rows synced
4771 Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
4772 Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
4773 ID string `json:"id" url:"id,key"` // team identifier
4774 Month string `json:"month" url:"month,key"` // year and month of the usage
4775 Name string `json:"name" url:"name,key"` // name of the team
4776 Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
4777 Space float64 `json:"space" url:"space,key"` // space credits used
4778 }
4779 type TeamMonthlyUsageInfoOpts struct {
4780 End *string `json:"end,omitempty" url:"end,omitempty,key"` // range end date
4781 Start string `json:"start" url:"start,key"` // range start date
4782 }
4783 type TeamMonthlyUsageInfoResult []TeamMonthlyUsage
4784
4785 // Retrieves usage for an enterprise team for a range of months. Start
4786 // and end dates can be specified as query parameters using the date,
4787 // YYYY-MM. If no end date is specified, one month of usage is returned.
4788 // The team identifier can be found from the [team list
4789 // endpoint](https://devcenter.heroku.com/articles/platform-api-reference
4790 // #team-list).
4791 //
4792 func (s *Service) TeamMonthlyUsageInfo(ctx context.Context, teamID string, o TeamMonthlyUsageInfoOpts, lr *ListRange) (TeamMonthlyUsageInfoResult, error) {
4793 var teamMonthlyUsage TeamMonthlyUsageInfoResult
4794 return teamMonthlyUsage, s.Get(ctx, &teamMonthlyUsage, fmt.Sprintf("/teams/%v/usage/monthly", teamID), o, lr)
4795 }
4796
4797 // Tracks a Team's Preferences
4798 type TeamPreferences struct {
4799 AddonsControls *bool `json:"addons-controls" url:"addons-controls,key"` // Whether add-on service rules should be applied to add-on
4800 // installations
4801 DefaultPermission *string `json:"default-permission" url:"default-permission,key"` // The default permission used when adding new members to the team
4802 }
4803
4804 // Retrieve Team Preferences
4805 func (s *Service) TeamPreferencesList(ctx context.Context, teamPreferencesIdentity string) (*TeamPreferences, error) {
4806 var teamPreferences TeamPreferences
4807 return &teamPreferences, s.Get(ctx, &teamPreferences, fmt.Sprintf("/teams/%v/preferences", teamPreferencesIdentity), nil, nil)
4808 }
4809
4810 type TeamPreferencesUpdateOpts struct {
4811 AddonsControls *bool `json:"addons-controls,omitempty" url:"addons-controls,omitempty,key"` // Whether add-on service rules should be applied to add-on
4812 // installations
4813 }
4814
4815 // Update Team Preferences
4816 func (s *Service) TeamPreferencesUpdate(ctx context.Context, teamPreferencesIdentity string, o TeamPreferencesUpdateOpts) (*TeamPreferences, error) {
4817 var teamPreferences TeamPreferences
4818 return &teamPreferences, s.Patch(ctx, &teamPreferences, fmt.Sprintf("/teams/%v/preferences", teamPreferencesIdentity), o)
4819 }
4820
4821 // A space is an isolated, highly available, secure app execution
4822 // environment.
4823 type TeamSpace struct{}
4824 type TeamSpaceListResult []struct {
4825 CIDR string `json:"cidr" url:"cidr,key"` // The RFC-1918 CIDR the Private Space will use. It must be a /16 in
4826 // 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16
4827 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when space was created
4828 DataCIDR string `json:"data_cidr" url:"data_cidr,key"` // The RFC-1918 CIDR that the Private Space will use for the
4829 // Heroku-managed peering connection that's automatically created when
4830 // using Heroku Data add-ons. It must be between a /16 and a /20
4831 ID string `json:"id" url:"id,key"` // unique identifier of space
4832 Name string `json:"name" url:"name,key"` // unique name of space
4833 Organization struct {
4834 Name string `json:"name" url:"name,key"` // unique name of team
4835 } `json:"organization" url:"organization,key"` // organization that owns this space
4836 Region struct {
4837 ID string `json:"id" url:"id,key"` // unique identifier of region
4838 Name string `json:"name" url:"name,key"` // unique name of region
4839 } `json:"region" url:"region,key"` // identity of space region
4840 Shield bool `json:"shield" url:"shield,key"` // true if this space has shield enabled
4841 State string `json:"state" url:"state,key"` // availability of this space
4842 Team struct {
4843 ID string `json:"id" url:"id,key"` // unique identifier of team
4844 Name string `json:"name" url:"name,key"` // unique name of team
4845 } `json:"team" url:"team,key"` // team that owns this space
4846 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when space was updated
4847 }
4848
4849 // List spaces owned by the team
4850 func (s *Service) TeamSpaceList(ctx context.Context, teamIdentity string, lr *ListRange) (TeamSpaceListResult, error) {
4851 var teamSpace TeamSpaceListResult
4852 return teamSpace, s.Get(ctx, &teamSpace, fmt.Sprintf("/teams/%v/spaces", teamIdentity), nil, lr)
4853 }
4854
4855 // A single test case belonging to a test run
4856 type TestCase struct {
4857 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when test case was created
4858 Description string `json:"description" url:"description,key"` // description of the test case
4859 Diagnostic string `json:"diagnostic" url:"diagnostic,key"` // meta information about the test case
4860 Directive string `json:"directive" url:"directive,key"` // special note about the test case e.g. skipped, todo
4861 ID string `json:"id" url:"id,key"` // unique identifier of a test case
4862 Number int `json:"number" url:"number,key"` // the test number
4863 Passed bool `json:"passed" url:"passed,key"` // whether the test case was successful
4864 TestNode struct {
4865 ID string `json:"id" url:"id,key"` // unique identifier of a test node
4866 } `json:"test_node" url:"test_node,key"` // the test node which executed this test case
4867 TestRun struct {
4868 ID string `json:"id" url:"id,key"` // unique identifier of a test run
4869 } `json:"test_run" url:"test_run,key"` // the test run which owns this test case
4870 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when test case was updated
4871 }
4872 type TestCaseListResult []TestCase
4873
4874 // List test cases
4875 func (s *Service) TestCaseList(ctx context.Context, testRunID string, lr *ListRange) error {
4876 return s.Get(ctx, nil, fmt.Sprintf("/test-runs/%v/test-cases", testRunID), nil, lr)
4877 }
4878
4879 // A single test node belonging to a test run
4880 type TestNode struct {
4881 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when test node was created
4882 Dyno *struct {
4883 AttachURL *string `json:"attach_url" url:"attach_url,key"` // a URL to stream output from for debug runs or null for non-debug runs
4884 ID string `json:"id" url:"id,key"` // unique identifier of this dyno
4885 } `json:"dyno" url:"dyno,key"` // the dyno which belongs to this test node
4886 ErrorStatus *string `json:"error_status" url:"error_status,key"` // the status of the test run when the error occured
4887 ExitCode *int `json:"exit_code" url:"exit_code,key"` // the exit code of the test script
4888 ID string `json:"id" url:"id,key"` // unique identifier of a test node
4889 Index int `json:"index" url:"index,key"` // The index of the test node
4890 Message *string `json:"message" url:"message,key"` // human friendly message indicating reason for an error
4891 OutputStreamURL string `json:"output_stream_url" url:"output_stream_url,key"` // the streaming output for the test node
4892 Pipeline struct {
4893 ID string `json:"id" url:"id,key"` // unique identifier of pipeline
4894 } `json:"pipeline" url:"pipeline,key"` // the pipeline which owns this test node
4895 SetupStreamURL string `json:"setup_stream_url" url:"setup_stream_url,key"` // the streaming test setup output for the test node
4896 Status string `json:"status" url:"status,key"` // current state of the test run
4897 TestRun struct {
4898 ID string `json:"id" url:"id,key"` // unique identifier of a test run
4899 } `json:"test_run" url:"test_run,key"` // the test run which owns this test node
4900 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when test node was updated
4901 }
4902 type TestNodeListResult []TestNode
4903
4904 // List test nodes
4905 func (s *Service) TestNodeList(ctx context.Context, testRunIdentity string, lr *ListRange) error {
4906 return s.Get(ctx, nil, fmt.Sprintf("/test-runs/%v/test-nodes", testRunIdentity), nil, lr)
4907 }
4908
4909 // An execution or trial of one or more tests
4910 type TestRun struct {
4911 ActorEmail string `json:"actor_email" url:"actor_email,key"` // the email of the actor triggering the test run
4912 AppSetup *struct{} `json:"app_setup" url:"app_setup,key"` // the app setup for the test run
4913 ClearCache *bool `json:"clear_cache" url:"clear_cache,key"` // whether the test was run with an empty cache
4914 CommitBranch string `json:"commit_branch" url:"commit_branch,key"` // the branch of the repository that the test run concerns
4915 CommitMessage string `json:"commit_message" url:"commit_message,key"` // the message for the commit under test
4916 CommitSha string `json:"commit_sha" url:"commit_sha,key"` // the SHA hash of the commit under test
4917 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when test run was created
4918 Debug bool `json:"debug" url:"debug,key"` // whether the test run was started for interactive debugging
4919 Dyno *struct {
4920 Size string `json:"size" url:"size,key"` // dyno size (default: "standard-1X")
4921 } `json:"dyno" url:"dyno,key"` // the type of dynos used for this test-run
4922 ID string `json:"id" url:"id,key"` // unique identifier of a test run
4923 Message *string `json:"message" url:"message,key"` // human friendly message indicating reason for an error
4924 Number int `json:"number" url:"number,key"` // the auto incrementing test run number
4925 Organization *struct {
4926 Name string `json:"name" url:"name,key"` // unique name of team
4927 } `json:"organization" url:"organization,key"` // the team that owns this test-run
4928 Pipeline struct {
4929 ID string `json:"id" url:"id,key"` // unique identifier of pipeline
4930 } `json:"pipeline" url:"pipeline,key"` // the pipeline which owns this test-run
4931 SourceBlobURL string `json:"source_blob_url" url:"source_blob_url,key"` // The download location for the source code to be tested
4932 Status string `json:"status" url:"status,key"` // current state of the test run
4933 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when test-run was updated
4934 User struct {
4935 AllowTracking bool `json:"allow_tracking" url:"allow_tracking,key"` // whether to allow third party web activity tracking
4936 Beta bool `json:"beta" url:"beta,key"` // whether allowed to utilize beta Heroku features
4937 CountryOfResidence *string `json:"country_of_residence" url:"country_of_residence,key"` // country where account owner resides
4938 CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when account was created
4939 DefaultOrganization *struct {
4940 ID string `json:"id" url:"id,key"` // unique identifier of team
4941 Name string `json:"name" url:"name,key"` // unique name of team
4942 } `json:"default_organization" url:"default_organization,key"` // team selected by default
4943 DefaultTeam *struct {
4944 ID string `json:"id" url:"id,key"` // unique identifier of team
4945 Name string `json:"name" url:"name,key"` // unique name of team
4946 } `json:"default_team" url:"default_team,key"` // team selected by default
4947 DelinquentAt *time.Time `json:"delinquent_at" url:"delinquent_at,key"` // when account became delinquent
4948 Email string `json:"email" url:"email,key"` // unique email address of account
4949 Federated bool `json:"federated" url:"federated,key"` // whether the user is federated and belongs to an Identity Provider
4950 ID string `json:"id" url:"id,key"` // unique identifier of an account
4951 IdentityProvider *struct {
4952 ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
4953 Name string `json:"name" url:"name,key"` // user-friendly unique identifier for this identity provider
4954 Organization struct {
4955 Name string `json:"name" url:"name,key"` // unique name of team
4956 } `json:"organization" url:"organization,key"`
4957 Owner struct {
4958 ID string `json:"id" url:"id,key"` // unique identifier of the owner
4959 Name string `json:"name" url:"name,key"` // name of the owner
4960 Type string `json:"type" url:"type,key"` // type of the owner
4961 } `json:"owner" url:"owner,key"` // entity that owns this identity provider
4962 Team struct {
4963 Name string `json:"name" url:"name,key"` // unique name of team
4964 } `json:"team" url:"team,key"`
4965 } `json:"identity_provider" url:"identity_provider,key"` // Identity Provider details for federated users.
4966 LastLogin *time.Time `json:"last_login" url:"last_login,key"` // when account last authorized with Heroku
4967 Name *string `json:"name" url:"name,key"` // full name of the account owner
4968 SmsNumber *string `json:"sms_number" url:"sms_number,key"` // SMS number of account
4969 SuspendedAt *time.Time `json:"suspended_at" url:"suspended_at,key"` // when account was suspended
4970 TwoFactorAuthentication bool `json:"two_factor_authentication" url:"two_factor_authentication,key"` // whether two-factor auth is enabled on the account
4971 UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when account was updated
4972 Verified bool `json:"verified" url:"verified,key"` // whether account has been verified with billing information
4973 } `json:"user" url:"user,key"` // An account represents an individual signed up to use the Heroku
4974 // platform.
4975 WarningMessage *string `json:"warning_message" url:"warning_message,key"` // human friently warning emitted during the test run
4976 }
4977 type TestRunCreateOpts struct {
4978 CommitBranch string `json:"commit_branch" url:"commit_branch,key"` // the branch of the repository that the test run concerns
4979 CommitMessage string `json:"commit_message" url:"commit_message,key"` // the message for the commit under test
4980 CommitSha string `json:"commit_sha" url:"commit_sha,key"` // the SHA hash of the commit under test
4981 Debug *bool `json:"debug,omitempty" url:"debug,omitempty,key"` // whether the test run was started for interactive debugging
4982 Organization *string `json:"organization,omitempty" url:"organization,omitempty,key"` // unique name of team
4983 Pipeline string `json:"pipeline" url:"pipeline,key"` // unique identifier of pipeline
4984 SourceBlobURL string `json:"source_blob_url" url:"source_blob_url,key"` // The download location for the source code to be tested
4985 }
4986
4987 // Create a new test-run.
4988 func (s *Service) TestRunCreate(ctx context.Context, o TestRunCreateOpts) (*TestRun, error) {
4989 var testRun TestRun
4990 return &testRun, s.Post(ctx, &testRun, fmt.Sprintf("/test-runs"), o)
4991 }
4992
4993 // Info for existing test-run.
4994 func (s *Service) TestRunInfo(ctx context.Context, testRunID string) (*TestRun, error) {
4995 var testRun TestRun
4996 return &testRun, s.Get(ctx, &testRun, fmt.Sprintf("/test-runs/%v", testRunID), nil, nil)
4997 }
4998
4999 type TestRunListResult []TestRun
5000
5001 // List existing test-runs for a pipeline.
5002 func (s *Service) TestRunList(ctx context.Context, pipelineID string, lr *ListRange) error {
5003 return s.Get(ctx, nil, fmt.Sprintf("/pipelines/%v/test-runs", pipelineID), nil, lr)
5004 }
5005
5006 // Info for existing test-run by Pipeline
5007 func (s *Service) TestRunInfoByPipeline(ctx context.Context, pipelineID string, testRunNumber int) (*TestRun, error) {
5008 var testRun TestRun
5009 return &testRun, s.Get(ctx, &testRun, fmt.Sprintf("/pipelines/%v/test-runs/%v", pipelineID, testRunNumber), nil, nil)
5010 }
5011
5012 type TestRunUpdateOpts struct {
5013 Message *string `json:"message" url:"message,key"` // human friendly message indicating reason for an error
5014 Status string `json:"status" url:"status,key"` // current state of the test run
5015 }
5016
5017 // Update a test-run's status.
5018 func (s *Service) TestRunUpdate(ctx context.Context, testRunNumber int, o TestRunUpdateOpts) (*TestRun, error) {
5019 var testRun TestRun
5020 return &testRun, s.Patch(ctx, &testRun, fmt.Sprintf("/test-runs/%v", testRunNumber), o)
5021 }
5022
5023 // Tracks a user's preferences and message dismissals
5024 type UserPreferences struct {
5025 DefaultOrganization *string `json:"default-organization" url:"default-organization,key"` // User's default team
5026 DismissedGettingStarted *bool `json:"dismissed-getting-started" url:"dismissed-getting-started,key"` // Whether the user has dismissed the getting started banner
5027 DismissedGithubBanner *bool `json:"dismissed-github-banner" url:"dismissed-github-banner,key"` // Whether the user has dismissed the GitHub link banner
5028 DismissedOrgAccessControls *bool `json:"dismissed-org-access-controls" url:"dismissed-org-access-controls,key"` // Whether the user has dismissed the Organization Access Controls
5029 // banner
5030 DismissedOrgWizardNotification *bool `json:"dismissed-org-wizard-notification" url:"dismissed-org-wizard-notification,key"` // Whether the user has dismissed the Organization Wizard
5031 DismissedPipelinesBanner *bool `json:"dismissed-pipelines-banner" url:"dismissed-pipelines-banner,key"` // Whether the user has dismissed the Pipelines banner
5032 DismissedPipelinesGithubBanner *bool `json:"dismissed-pipelines-github-banner" url:"dismissed-pipelines-github-banner,key"` // Whether the user has dismissed the GitHub banner on a pipeline
5033 // overview
5034 DismissedPipelinesGithubBanners []string `json:"dismissed-pipelines-github-banners" url:"dismissed-pipelines-github-banners,key"` // Which pipeline uuids the user has dismissed the GitHub banner for
5035 DismissedSmsBanner *bool `json:"dismissed-sms-banner" url:"dismissed-sms-banner,key"` // Whether the user has dismissed the 2FA SMS banner
5036 Timezone *string `json:"timezone" url:"timezone,key"` // User's default timezone
5037 }
5038
5039 // Retrieve User Preferences
5040 func (s *Service) UserPreferencesList(ctx context.Context, userPreferencesIdentity string) (*UserPreferences, error) {
5041 var userPreferences UserPreferences
5042 return &userPreferences, s.Get(ctx, &userPreferences, fmt.Sprintf("/users/%v/preferences", userPreferencesIdentity), nil, nil)
5043 }
5044
5045 type UserPreferencesUpdateOpts struct {
5046 DefaultOrganization *string `json:"default-organization,omitempty" url:"default-organization,omitempty,key"` // User's default team
5047 DismissedGettingStarted *bool `json:"dismissed-getting-started,omitempty" url:"dismissed-getting-started,omitempty,key"` // Whether the user has dismissed the getting started banner
5048 DismissedGithubBanner *bool `json:"dismissed-github-banner,omitempty" url:"dismissed-github-banner,omitempty,key"` // Whether the user has dismissed the GitHub link banner
5049 DismissedOrgAccessControls *bool `json:"dismissed-org-access-controls,omitempty" url:"dismissed-org-access-controls,omitempty,key"` // Whether the user has dismissed the Organization Access Controls
5050 // banner
5051 DismissedOrgWizardNotification *bool `json:"dismissed-org-wizard-notification,omitempty" url:"dismissed-org-wizard-notification,omitempty,key"` // Whether the user has dismissed the Organization Wizard
5052 DismissedPipelinesBanner *bool `json:"dismissed-pipelines-banner,omitempty" url:"dismissed-pipelines-banner,omitempty,key"` // Whether the user has dismissed the Pipelines banner
5053 DismissedPipelinesGithubBanner *bool `json:"dismissed-pipelines-github-banner,omitempty" url:"dismissed-pipelines-github-banner,omitempty,key"` // Whether the user has dismissed the GitHub banner on a pipeline
5054 // overview
5055 DismissedPipelinesGithubBanners []*string `json:"dismissed-pipelines-github-banners,omitempty" url:"dismissed-pipelines-github-banners,omitempty,key"` // Which pipeline uuids the user has dismissed the GitHub banner for
5056 DismissedSmsBanner *bool `json:"dismissed-sms-banner,omitempty" url:"dismissed-sms-banner,omitempty,key"` // Whether the user has dismissed the 2FA SMS banner
5057 Timezone *string `json:"timezone,omitempty" url:"timezone,omitempty,key"` // User's default timezone
5058 }
5059
5060 // Update User Preferences
5061 func (s *Service) UserPreferencesUpdate(ctx context.Context, userPreferencesIdentity string, o UserPreferencesUpdateOpts) (*UserPreferences, error) {
5062 var userPreferences UserPreferences
5063 return &userPreferences, s.Patch(ctx, &userPreferences, fmt.Sprintf("/users/%v/preferences", userPreferencesIdentity), o)
5064 }
5065
5066 // [VPN](https://devcenter.heroku.com/articles/private-space-vpn-connecti
5067 // on) provides a way to connect your Private Spaces to your network via
5068 // VPN.
5069 type VPNConnection struct {
5070 ID string `json:"id" url:"id,key"` // VPN ID
5071 IKEVersion int `json:"ike_version" url:"ike_version,key"` // IKE Version
5072 Name string `json:"name" url:"name,key"` // VPN Name
5073 PublicIP string `json:"public_ip" url:"public_ip,key"` // Public IP of VPN customer gateway
5074 RoutableCidrs []string `json:"routable_cidrs" url:"routable_cidrs,key"` // Routable CIDRs of VPN
5075 SpaceCIDRBlock string `json:"space_cidr_block" url:"space_cidr_block,key"` // CIDR Block of the Private Space
5076 Status string `json:"status" url:"status,key"` // Status of the VPN
5077 StatusMessage string `json:"status_message" url:"status_message,key"` // Details of the status
5078 Tunnels []struct {
5079 CustomerIP string `json:"customer_ip" url:"customer_ip,key"` // Public IP address for the customer side of the tunnel
5080 IP string `json:"ip" url:"ip,key"` // Public IP address for the tunnel
5081 LastStatusChange string `json:"last_status_change" url:"last_status_change,key"` // Timestamp of last status changed
5082 PreSharedKey string `json:"pre_shared_key" url:"pre_shared_key,key"` // Pre-shared key
5083 Status string `json:"status" url:"status,key"` // Status of the tunnel
5084 StatusMessage string `json:"status_message" url:"status_message,key"` // Details of the status
5085 } `json:"tunnels" url:"tunnels,key"`
5086 }
5087 type VPNConnectionCreateOpts struct {
5088 Name string `json:"name" url:"name,key"` // VPN Name
5089 PublicIP string `json:"public_ip" url:"public_ip,key"` // Public IP of VPN customer gateway
5090 RoutableCidrs []string `json:"routable_cidrs" url:"routable_cidrs,key"` // Routable CIDRs of VPN
5091 }
5092
5093 // Create a new VPN connection in a private space.
5094 func (s *Service) VPNConnectionCreate(ctx context.Context, spaceIdentity string, o VPNConnectionCreateOpts) (*VPNConnection, error) {
5095 var vpnConnection VPNConnection
5096 return &vpnConnection, s.Post(ctx, &vpnConnection, fmt.Sprintf("/spaces/%v/vpn-connections", spaceIdentity), o)
5097 }
5098
5099 // Destroy existing VPN Connection
5100 func (s *Service) VPNConnectionDestroy(ctx context.Context, spaceIdentity string, vpnConnectionIdentity string) (*VPNConnection, error) {
5101 var vpnConnection VPNConnection
5102 return &vpnConnection, s.Delete(ctx, &vpnConnection, fmt.Sprintf("/spaces/%v/vpn-connections/%v", spaceIdentity, vpnConnectionIdentity))
5103 }
5104
5105 type VPNConnectionListResult []VPNConnection
5106
5107 // List VPN connections for a space.
5108 func (s *Service) VPNConnectionList(ctx context.Context, spaceIdentity string, lr *ListRange) (VPNConnectionListResult, error) {
5109 var vpnConnection VPNConnectionListResult
5110 return vpnConnection, s.Get(ctx, &vpnConnection, fmt.Sprintf("/spaces/%v/vpn-connections", spaceIdentity), nil, lr)
5111 }
5112
5113 // Info for an existing vpn-connection.
5114 func (s *Service) VPNConnectionInfo(ctx context.Context, spaceIdentity string, vpnConnectionIdentity string) (*VPNConnection, error) {
5115 var vpnConnection VPNConnection
5116 return &vpnConnection, s.Get(ctx, &vpnConnection, fmt.Sprintf("/spaces/%v/vpn-connections/%v", spaceIdentity, vpnConnectionIdentity), nil, nil)
5117 }
5118
5119 type VPNConnectionUpdateOpts struct {
5120 RoutableCidrs []string `json:"routable_cidrs" url:"routable_cidrs,key"` // Routable CIDRs of VPN
5121 }
5122
5123 // Update a VPN connection in a private space.
5124 func (s *Service) VPNConnectionUpdate(ctx context.Context, spaceIdentity string, vpnConnectionIdentity string, o VPNConnectionUpdateOpts) (*VPNConnection, error) {
5125 var vpnConnection VPNConnection
5126 return &vpnConnection, s.Patch(ctx, &vpnConnection, fmt.Sprintf("/spaces/%v/vpn-connections/%v", spaceIdentity, vpnConnectionIdentity), o)
5127 }