OLD | NEW |
1 // Copyright 2017 The LUCI Authors. All rights reserved. | 1 // Copyright 2017 The LUCI Authors. All rights reserved. |
2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
4 | 4 |
5 // Package buildbucket provides access to the Build Bucket Service. | 5 // Package buildbucket provides access to the Build Bucket Service. |
6 // | 6 // |
7 // Usage example: | 7 // Usage example: |
8 // | 8 // |
9 // import "github.com/luci/luci-go/common/api/buildbucket/buildbucket/v1" | 9 // import "github.com/luci/luci-go/common/api/buildbucket/buildbucket/v1" |
10 // ... | 10 // ... |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // Possible values: | 146 // Possible values: |
147 // "CANCELED" | 147 // "CANCELED" |
148 // "FAILURE" | 148 // "FAILURE" |
149 // "SUCCESS" | 149 // "SUCCESS" |
150 Result string `json:"result,omitempty"` | 150 Result string `json:"result,omitempty"` |
151 | 151 |
152 ResultDetailsJson string `json:"result_details_json,omitempty"` | 152 ResultDetailsJson string `json:"result_details_json,omitempty"` |
153 | 153 |
154 RetryOf int64 `json:"retry_of,omitempty,string"` | 154 RetryOf int64 `json:"retry_of,omitempty,string"` |
155 | 155 |
| 156 StartedTs int64 `json:"started_ts,omitempty,string"` |
| 157 |
156 // Possible values: | 158 // Possible values: |
157 // "COMPLETED" | 159 // "COMPLETED" |
158 // "SCHEDULED" | 160 // "SCHEDULED" |
159 // "STARTED" | 161 // "STARTED" |
160 Status string `json:"status,omitempty"` | 162 Status string `json:"status,omitempty"` |
161 | 163 |
162 StatusChangedTs int64 `json:"status_changed_ts,omitempty,string"` | 164 StatusChangedTs int64 `json:"status_changed_ts,omitempty,string"` |
163 | 165 |
164 Tags []string `json:"tags,omitempty"` | 166 Tags []string `json:"tags,omitempty"` |
165 | 167 |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 *noMethod | 629 *noMethod |
628 } | 630 } |
629 s1.noMethod = (*noMethod)(s) | 631 s1.noMethod = (*noMethod)(s) |
630 if err := json.Unmarshal(data, &s1); err != nil { | 632 if err := json.Unmarshal(data, &s1); err != nil { |
631 return err | 633 return err |
632 } | 634 } |
633 s.LongestPendingTimeSec = float64(s1.LongestPendingTimeSec) | 635 s.LongestPendingTimeSec = float64(s1.LongestPendingTimeSec) |
634 return nil | 636 return nil |
635 } | 637 } |
636 | 638 |
| 639 type ApiPauseResponse struct { |
| 640 // ServerResponse contains the HTTP response code and headers from the |
| 641 // server. |
| 642 googleapi.ServerResponse `json:"-"` |
| 643 } |
| 644 |
637 type ApiPubSubCallbackMessage struct { | 645 type ApiPubSubCallbackMessage struct { |
638 AuthToken string `json:"auth_token,omitempty"` | 646 AuthToken string `json:"auth_token,omitempty"` |
639 | 647 |
640 Topic string `json:"topic,omitempty"` | 648 Topic string `json:"topic,omitempty"` |
641 | 649 |
642 UserData string `json:"user_data,omitempty"` | 650 UserData string `json:"user_data,omitempty"` |
643 | 651 |
644 // ForceSendFields is a list of field names (e.g. "AuthToken") to | 652 // ForceSendFields is a list of field names (e.g. "AuthToken") to |
645 // unconditionally include in API requests. By default, fields with | 653 // unconditionally include in API requests. By default, fields with |
646 // empty values are omitted from API requests. However, any non-pointer, | 654 // empty values are omitted from API requests. However, any non-pointer, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 NullFields []string `json:"-"` | 692 NullFields []string `json:"-"` |
685 } | 693 } |
686 | 694 |
687 func (s *ApiPutBatchRequestMessage) MarshalJSON() ([]byte, error) { | 695 func (s *ApiPutBatchRequestMessage) MarshalJSON() ([]byte, error) { |
688 type noMethod ApiPutBatchRequestMessage | 696 type noMethod ApiPutBatchRequestMessage |
689 raw := noMethod(*s) | 697 raw := noMethod(*s) |
690 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) | 698 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
691 } | 699 } |
692 | 700 |
693 type ApiPutBatchResponseMessage struct { | 701 type ApiPutBatchResponseMessage struct { |
| 702 Error *ApiErrorMessage `json:"error,omitempty"` |
| 703 |
694 Results []*ApiPutBatchResponseMessageOneResult `json:"results,omitempty"
` | 704 Results []*ApiPutBatchResponseMessageOneResult `json:"results,omitempty"
` |
695 | 705 |
696 // ServerResponse contains the HTTP response code and headers from the | 706 // ServerResponse contains the HTTP response code and headers from the |
697 // server. | 707 // server. |
698 googleapi.ServerResponse `json:"-"` | 708 googleapi.ServerResponse `json:"-"` |
699 | 709 |
700 » // ForceSendFields is a list of field names (e.g. "Results") to | 710 » // ForceSendFields is a list of field names (e.g. "Error") to |
701 // unconditionally include in API requests. By default, fields with | 711 // unconditionally include in API requests. By default, fields with |
702 // empty values are omitted from API requests. However, any non-pointer, | 712 // empty values are omitted from API requests. However, any non-pointer, |
703 // non-interface field appearing in ForceSendFields will be sent to the | 713 // non-interface field appearing in ForceSendFields will be sent to the |
704 // server regardless of whether the field is empty or not. This may be | 714 // server regardless of whether the field is empty or not. This may be |
705 // used to include empty fields in Patch requests. | 715 // used to include empty fields in Patch requests. |
706 ForceSendFields []string `json:"-"` | 716 ForceSendFields []string `json:"-"` |
707 | 717 |
708 » // NullFields is a list of field names (e.g. "Results") to include in | 718 » // NullFields is a list of field names (e.g. "Error") to include in API |
709 » // API requests with the JSON null value. By default, fields with empty | 719 » // requests with the JSON null value. By default, fields with empty |
710 // values are omitted from API requests. However, any field with an | 720 // values are omitted from API requests. However, any field with an |
711 // empty value appearing in NullFields will be sent to the server as | 721 // empty value appearing in NullFields will be sent to the server as |
712 // null. It is an error if a field in this list has a non-empty value. | 722 // null. It is an error if a field in this list has a non-empty value. |
713 // This may be used to include null fields in Patch requests. | 723 // This may be used to include null fields in Patch requests. |
714 NullFields []string `json:"-"` | 724 NullFields []string `json:"-"` |
715 } | 725 } |
716 | 726 |
717 func (s *ApiPutBatchResponseMessage) MarshalJSON() ([]byte, error) { | 727 func (s *ApiPutBatchResponseMessage) MarshalJSON() ([]byte, error) { |
718 type noMethod ApiPutBatchResponseMessage | 728 type noMethod ApiPutBatchResponseMessage |
719 raw := noMethod(*s) | 729 raw := noMethod(*s) |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 // This may be used to include null fields in Patch requests. | 916 // This may be used to include null fields in Patch requests. |
907 NullFields []string `json:"-"` | 917 NullFields []string `json:"-"` |
908 } | 918 } |
909 | 919 |
910 func (s *ApiSucceedRequestBodyMessage) MarshalJSON() ([]byte, error) { | 920 func (s *ApiSucceedRequestBodyMessage) MarshalJSON() ([]byte, error) { |
911 type noMethod ApiSucceedRequestBodyMessage | 921 type noMethod ApiSucceedRequestBodyMessage |
912 raw := noMethod(*s) | 922 raw := noMethod(*s) |
913 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) | 923 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
914 } | 924 } |
915 | 925 |
| 926 // method id "buildbucket.backfill_tag_index": |
| 927 |
| 928 type BackfillTagIndexCall struct { |
| 929 s *Service |
| 930 urlParams_ gensupport.URLParams |
| 931 ctx_ context.Context |
| 932 header_ http.Header |
| 933 } |
| 934 |
| 935 // BackfillTagIndex: Backfills TagIndex entites from builds. |
| 936 func (s *Service) BackfillTagIndex(tag string, shards int64) *BackfillTagIndexCa
ll { |
| 937 c := &BackfillTagIndexCall{s: s, urlParams_: make(gensupport.URLParams)} |
| 938 c.urlParams_.Set("tag", tag) |
| 939 c.urlParams_.Set("shards", fmt.Sprint(shards)) |
| 940 return c |
| 941 } |
| 942 |
| 943 // Fields allows partial responses to be retrieved. See |
| 944 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| 945 // for more information. |
| 946 func (c *BackfillTagIndexCall) Fields(s ...googleapi.Field) *BackfillTagIndexCal
l { |
| 947 c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 948 return c |
| 949 } |
| 950 |
| 951 // Context sets the context to be used in this call's Do method. Any |
| 952 // pending HTTP request will be aborted if the provided context is |
| 953 // canceled. |
| 954 func (c *BackfillTagIndexCall) Context(ctx context.Context) *BackfillTagIndexCal
l { |
| 955 c.ctx_ = ctx |
| 956 return c |
| 957 } |
| 958 |
| 959 // Header returns an http.Header that can be modified by the caller to |
| 960 // add HTTP headers to the request. |
| 961 func (c *BackfillTagIndexCall) Header() http.Header { |
| 962 if c.header_ == nil { |
| 963 c.header_ = make(http.Header) |
| 964 } |
| 965 return c.header_ |
| 966 } |
| 967 |
| 968 func (c *BackfillTagIndexCall) doRequest(alt string) (*http.Response, error) { |
| 969 reqHeaders := make(http.Header) |
| 970 for k, v := range c.header_ { |
| 971 reqHeaders[k] = v |
| 972 } |
| 973 reqHeaders.Set("User-Agent", c.s.userAgent()) |
| 974 var body io.Reader = nil |
| 975 c.urlParams_.Set("alt", alt) |
| 976 urls := googleapi.ResolveRelative(c.s.BasePath, "backfill_tag_index") |
| 977 urls += "?" + c.urlParams_.Encode() |
| 978 req, _ := http.NewRequest("POST", urls, body) |
| 979 req.Header = reqHeaders |
| 980 return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 981 } |
| 982 |
| 983 // Do executes the "buildbucket.backfill_tag_index" call. |
| 984 func (c *BackfillTagIndexCall) Do(opts ...googleapi.CallOption) error { |
| 985 gensupport.SetOptions(c.urlParams_, opts...) |
| 986 res, err := c.doRequest("json") |
| 987 if err != nil { |
| 988 return err |
| 989 } |
| 990 defer googleapi.CloseBody(res) |
| 991 if err := googleapi.CheckResponse(res); err != nil { |
| 992 return err |
| 993 } |
| 994 return nil |
| 995 // { |
| 996 // "description": "Backfills TagIndex entites from builds.", |
| 997 // "httpMethod": "POST", |
| 998 // "id": "buildbucket.backfill_tag_index", |
| 999 // "parameterOrder": [ |
| 1000 // "tag", |
| 1001 // "shards" |
| 1002 // ], |
| 1003 // "parameters": { |
| 1004 // "shards": { |
| 1005 // "format": "int64", |
| 1006 // "location": "query", |
| 1007 // "required": true, |
| 1008 // "type": "string" |
| 1009 // }, |
| 1010 // "tag": { |
| 1011 // "location": "query", |
| 1012 // "required": true, |
| 1013 // "type": "string" |
| 1014 // } |
| 1015 // }, |
| 1016 // "path": "backfill_tag_index", |
| 1017 // "scopes": [ |
| 1018 // "https://www.googleapis.com/auth/userinfo.email" |
| 1019 // ] |
| 1020 // } |
| 1021 |
| 1022 } |
| 1023 |
916 // method id "buildbucket.cancel": | 1024 // method id "buildbucket.cancel": |
917 | 1025 |
918 type CancelCall struct { | 1026 type CancelCall struct { |
919 s *Service | 1027 s *Service |
920 id int64 | 1028 id int64 |
921 urlParams_ gensupport.URLParams | 1029 urlParams_ gensupport.URLParams |
922 ctx_ context.Context | 1030 ctx_ context.Context |
923 header_ http.Header | 1031 header_ http.Header |
924 } | 1032 } |
925 | 1033 |
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2240 // "response": { | 2348 // "response": { |
2241 // "$ref": "ApiLongestPendingTimeResponse" | 2349 // "$ref": "ApiLongestPendingTimeResponse" |
2242 // }, | 2350 // }, |
2243 // "scopes": [ | 2351 // "scopes": [ |
2244 // "https://www.googleapis.com/auth/userinfo.email" | 2352 // "https://www.googleapis.com/auth/userinfo.email" |
2245 // ] | 2353 // ] |
2246 // } | 2354 // } |
2247 | 2355 |
2248 } | 2356 } |
2249 | 2357 |
| 2358 // method id "buildbucket.pause": |
| 2359 |
| 2360 type PauseCall struct { |
| 2361 s *Service |
| 2362 bucket string |
| 2363 urlParams_ gensupport.URLParams |
| 2364 ctx_ context.Context |
| 2365 header_ http.Header |
| 2366 } |
| 2367 |
| 2368 // Pause: Pauses or unpause a bucket. |
| 2369 func (s *Service) Pause(bucket string, isPaused bool) *PauseCall { |
| 2370 c := &PauseCall{s: s, urlParams_: make(gensupport.URLParams)} |
| 2371 c.bucket = bucket |
| 2372 c.urlParams_.Set("is_paused", fmt.Sprint(isPaused)) |
| 2373 return c |
| 2374 } |
| 2375 |
| 2376 // Fields allows partial responses to be retrieved. See |
| 2377 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| 2378 // for more information. |
| 2379 func (c *PauseCall) Fields(s ...googleapi.Field) *PauseCall { |
| 2380 c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 2381 return c |
| 2382 } |
| 2383 |
| 2384 // Context sets the context to be used in this call's Do method. Any |
| 2385 // pending HTTP request will be aborted if the provided context is |
| 2386 // canceled. |
| 2387 func (c *PauseCall) Context(ctx context.Context) *PauseCall { |
| 2388 c.ctx_ = ctx |
| 2389 return c |
| 2390 } |
| 2391 |
| 2392 // Header returns an http.Header that can be modified by the caller to |
| 2393 // add HTTP headers to the request. |
| 2394 func (c *PauseCall) Header() http.Header { |
| 2395 if c.header_ == nil { |
| 2396 c.header_ = make(http.Header) |
| 2397 } |
| 2398 return c.header_ |
| 2399 } |
| 2400 |
| 2401 func (c *PauseCall) doRequest(alt string) (*http.Response, error) { |
| 2402 reqHeaders := make(http.Header) |
| 2403 for k, v := range c.header_ { |
| 2404 reqHeaders[k] = v |
| 2405 } |
| 2406 reqHeaders.Set("User-Agent", c.s.userAgent()) |
| 2407 var body io.Reader = nil |
| 2408 c.urlParams_.Set("alt", alt) |
| 2409 urls := googleapi.ResolveRelative(c.s.BasePath, "buckets/{bucket}/pause"
) |
| 2410 urls += "?" + c.urlParams_.Encode() |
| 2411 req, _ := http.NewRequest("POST", urls, body) |
| 2412 req.Header = reqHeaders |
| 2413 googleapi.Expand(req.URL, map[string]string{ |
| 2414 "bucket": c.bucket, |
| 2415 }) |
| 2416 return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 2417 } |
| 2418 |
| 2419 // Do executes the "buildbucket.pause" call. |
| 2420 // Exactly one of *ApiPauseResponse or error will be non-nil. Any |
| 2421 // non-2xx status code is an error. Response headers are in either |
| 2422 // *ApiPauseResponse.ServerResponse.Header or (if a response was |
| 2423 // returned at all) in error.(*googleapi.Error).Header. Use |
| 2424 // googleapi.IsNotModified to check whether the returned error was |
| 2425 // because http.StatusNotModified was returned. |
| 2426 func (c *PauseCall) Do(opts ...googleapi.CallOption) (*ApiPauseResponse, error)
{ |
| 2427 gensupport.SetOptions(c.urlParams_, opts...) |
| 2428 res, err := c.doRequest("json") |
| 2429 if res != nil && res.StatusCode == http.StatusNotModified { |
| 2430 if res.Body != nil { |
| 2431 res.Body.Close() |
| 2432 } |
| 2433 return nil, &googleapi.Error{ |
| 2434 Code: res.StatusCode, |
| 2435 Header: res.Header, |
| 2436 } |
| 2437 } |
| 2438 if err != nil { |
| 2439 return nil, err |
| 2440 } |
| 2441 defer googleapi.CloseBody(res) |
| 2442 if err := googleapi.CheckResponse(res); err != nil { |
| 2443 return nil, err |
| 2444 } |
| 2445 ret := &ApiPauseResponse{ |
| 2446 ServerResponse: googleapi.ServerResponse{ |
| 2447 Header: res.Header, |
| 2448 HTTPStatusCode: res.StatusCode, |
| 2449 }, |
| 2450 } |
| 2451 target := &ret |
| 2452 if err := json.NewDecoder(res.Body).Decode(target); err != nil { |
| 2453 return nil, err |
| 2454 } |
| 2455 return ret, nil |
| 2456 // { |
| 2457 // "description": "Pauses or unpause a bucket.", |
| 2458 // "httpMethod": "POST", |
| 2459 // "id": "buildbucket.pause", |
| 2460 // "parameterOrder": [ |
| 2461 // "bucket", |
| 2462 // "is_paused" |
| 2463 // ], |
| 2464 // "parameters": { |
| 2465 // "bucket": { |
| 2466 // "location": "path", |
| 2467 // "required": true, |
| 2468 // "type": "string" |
| 2469 // }, |
| 2470 // "is_paused": { |
| 2471 // "location": "query", |
| 2472 // "required": true, |
| 2473 // "type": "boolean" |
| 2474 // } |
| 2475 // }, |
| 2476 // "path": "buckets/{bucket}/pause", |
| 2477 // "response": { |
| 2478 // "$ref": "ApiPauseResponse" |
| 2479 // }, |
| 2480 // "scopes": [ |
| 2481 // "https://www.googleapis.com/auth/userinfo.email" |
| 2482 // ] |
| 2483 // } |
| 2484 |
| 2485 } |
| 2486 |
2250 // method id "buildbucket.peek": | 2487 // method id "buildbucket.peek": |
2251 | 2488 |
2252 type PeekCall struct { | 2489 type PeekCall struct { |
2253 s *Service | 2490 s *Service |
2254 urlParams_ gensupport.URLParams | 2491 urlParams_ gensupport.URLParams |
2255 ifNoneMatch_ string | 2492 ifNoneMatch_ string |
2256 ctx_ context.Context | 2493 ctx_ context.Context |
2257 header_ http.Header | 2494 header_ http.Header |
2258 } | 2495 } |
2259 | 2496 |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3442 // }, | 3679 // }, |
3443 // "response": { | 3680 // "response": { |
3444 // "$ref": "ApiBuildResponseMessage" | 3681 // "$ref": "ApiBuildResponseMessage" |
3445 // }, | 3682 // }, |
3446 // "scopes": [ | 3683 // "scopes": [ |
3447 // "https://www.googleapis.com/auth/userinfo.email" | 3684 // "https://www.googleapis.com/auth/userinfo.email" |
3448 // ] | 3685 // ] |
3449 // } | 3686 // } |
3450 | 3687 |
3451 } | 3688 } |
OLD | NEW |