blob: 318d1ebbdd48fb2a1a9d0930ef3229bd47a8c252 [file]
// Copyright 2022 The LUCI Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated file. DO NOT EDIT.
// Package buildbucket provides access to the Build Bucket Service.
//
// Creating a client
//
// Usage example:
//
// import "go.chromium.org/luci/common/api/buildbucket/buildbucket/v1"
// ...
// ctx := context.Background()
// buildbucketService, err := buildbucket.NewService(ctx)
//
// In this example, Google Application Default Credentials are used for authentication.
//
// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
//
// Other authentication options
//
// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
//
// buildbucketService, err := buildbucket.NewService(ctx, option.WithAPIKey("AIza..."))
//
// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
//
// config := &oauth2.Config{...}
// // ...
// token, err := config.Exchange(ctx, ...)
// buildbucketService, err := buildbucket.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
//
// See https://godoc.org/google.golang.org/api/option/ for details on options.
package buildbucket // import "go.chromium.org/luci/common/api/buildbucket/buildbucket/v1"
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"strings"
gensupport "go.chromium.org/luci/common/api/internal/gensupport"
googleapi "google.golang.org/api/googleapi"
option "google.golang.org/api/option"
htransport "google.golang.org/api/transport/http"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled
const apiId = "buildbucket:v1"
const apiName = "buildbucket"
const apiVersion = "v1"
const basePath = "http://localhost:8080/_ah/api/buildbucket/v1"
// OAuth2 scopes used by this API.
const (
// https://www.googleapis.com/auth/userinfo.email
UserinfoEmailScope = "https://www.googleapis.com/auth/userinfo.email"
)
// NewService creates a new Service.
func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
scopesOption := option.WithScopes(
"https://www.googleapis.com/auth/userinfo.email",
)
// NOTE: prepend, so we don't override user-specified scopes.
opts = append([]option.ClientOption{scopesOption}, opts...)
client, endpoint, err := htransport.NewClient(ctx, opts...)
if err != nil {
return nil, err
}
s, err := New(client)
if err != nil {
return nil, err
}
if endpoint != "" {
s.BasePath = endpoint
}
return s, nil
}
// New creates a new Service. It uses the provided http.Client for requests.
//
// Deprecated: please use NewService instead.
// To provide a custom HTTP client, use option.WithHTTPClient.
// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
type LegacyApiBuildResponseMessage struct {
// Build: Describes model.Build, see its docstring.
Build *LegacyApiCommonBuildMessage `json:"build,omitempty"`
Error *LegacyApiErrorMessage `json:"error,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Build") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Build") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiBuildResponseMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiBuildResponseMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiCancelRequestBodyMessage struct {
ResultDetailsJson string `json:"result_details_json,omitempty"`
// ForceSendFields is a list of field names (e.g. "ResultDetailsJson")
// to unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ResultDetailsJson") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiCancelRequestBodyMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiCancelRequestBodyMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// LegacyApiCommonBuildMessage: Describes model.Build, see its
// docstring.
type LegacyApiCommonBuildMessage struct {
Bucket string `json:"bucket,omitempty"`
Canary bool `json:"canary,omitempty"`
// Possible values:
// "AUTO"
// "CANARY"
// "PROD"
CanaryPreference string `json:"canary_preference,omitempty"`
// Possible values:
// "CANCELED_EXPLICITLY"
// "TIMEOUT"
// "UNSET"
CancelationReason string `json:"cancelation_reason,omitempty"`
CompletedTs int64 `json:"completed_ts,omitempty,string"`
CreatedBy string `json:"created_by,omitempty"`
CreatedTs int64 `json:"created_ts,omitempty,string"`
Experimental bool `json:"experimental,omitempty"`
// Possible values:
// "BUILDBUCKET_FAILURE"
// "BUILD_FAILURE"
// "INFRA_FAILURE"
// "INVALID_BUILD_DEFINITION"
// "UNSET"
FailureReason string `json:"failure_reason,omitempty"`
Id int64 `json:"id,omitempty,string"`
LeaseExpirationTs int64 `json:"lease_expiration_ts,omitempty,string"`
LeaseKey int64 `json:"lease_key,omitempty,string"`
ParametersJson string `json:"parameters_json,omitempty"`
Project string `json:"project,omitempty"`
// Possible values:
// "CANCELED"
// "FAILURE"
// "SUCCESS"
// "UNSET"
Result string `json:"result,omitempty"`
ResultDetailsJson string `json:"result_details_json,omitempty"`
RetryOf int64 `json:"retry_of,omitempty,string"`
ServiceAccount string `json:"service_account,omitempty"`
StartedTs int64 `json:"started_ts,omitempty,string"`
// Possible values:
// "COMPLETED"
// "SCHEDULED"
// "STARTED"
// "UNSET"
Status string `json:"status,omitempty"`
StatusChangedTs int64 `json:"status_changed_ts,omitempty,string"`
Tags []string `json:"tags,omitempty"`
UpdatedTs int64 `json:"updated_ts,omitempty,string"`
Url string `json:"url,omitempty"`
UtcnowTs int64 `json:"utcnow_ts,omitempty,string"`
// ForceSendFields is a list of field names (e.g. "Bucket") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Bucket") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiCommonBuildMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiCommonBuildMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiErrorMessage struct {
Message string `json:"message,omitempty"`
// Possible values:
// "BUILDER_NOT_FOUND"
// "BUILD_IS_COMPLETED"
// "BUILD_NOT_FOUND"
// "CANNOT_LEASE_BUILD"
// "INVALID_BUILD_STATE"
// "INVALID_INPUT"
// "LEASE_EXPIRED"
Reason string `json:"reason,omitempty"`
// ForceSendFields is a list of field names (e.g. "Message") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Message") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiErrorMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiErrorMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiFailRequestBodyMessage struct {
// Possible values:
// "BUILDBUCKET_FAILURE"
// "BUILD_FAILURE"
// "INFRA_FAILURE"
// "INVALID_BUILD_DEFINITION"
// "UNSET"
FailureReason string `json:"failure_reason,omitempty"`
LeaseKey int64 `json:"lease_key,omitempty,string"`
NewTags []string `json:"new_tags,omitempty"`
ResultDetailsJson string `json:"result_details_json,omitempty"`
Url string `json:"url,omitempty"`
// ForceSendFields is a list of field names (e.g. "FailureReason") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "FailureReason") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiFailRequestBodyMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiFailRequestBodyMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiHeartbeatBatchRequestMessage struct {
Heartbeats []*LegacyApiHeartbeatBatchRequestMessageOneHeartbeat `json:"heartbeats,omitempty"`
// ForceSendFields is a list of field names (e.g. "Heartbeats") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Heartbeats") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiHeartbeatBatchRequestMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiHeartbeatBatchRequestMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiHeartbeatBatchRequestMessageOneHeartbeat struct {
BuildId int64 `json:"build_id,omitempty,string"`
LeaseExpirationTs int64 `json:"lease_expiration_ts,omitempty,string"`
LeaseKey int64 `json:"lease_key,omitempty,string"`
// ForceSendFields is a list of field names (e.g. "BuildId") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BuildId") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiHeartbeatBatchRequestMessageOneHeartbeat) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiHeartbeatBatchRequestMessageOneHeartbeat
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiHeartbeatBatchResponseMessage struct {
Error *LegacyApiErrorMessage `json:"error,omitempty"`
Results []*LegacyApiHeartbeatBatchResponseMessageOneHeartbeatResult `json:"results,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Error") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Error") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiHeartbeatBatchResponseMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiHeartbeatBatchResponseMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiHeartbeatBatchResponseMessageOneHeartbeatResult struct {
BuildId int64 `json:"build_id,omitempty,string"`
Error *LegacyApiErrorMessage `json:"error,omitempty"`
LeaseExpirationTs int64 `json:"lease_expiration_ts,omitempty,string"`
// ForceSendFields is a list of field names (e.g. "BuildId") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BuildId") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiHeartbeatBatchResponseMessageOneHeartbeatResult) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiHeartbeatBatchResponseMessageOneHeartbeatResult
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiHeartbeatRequestBodyMessage struct {
LeaseExpirationTs int64 `json:"lease_expiration_ts,omitempty,string"`
LeaseKey int64 `json:"lease_key,omitempty,string"`
// ForceSendFields is a list of field names (e.g. "LeaseExpirationTs")
// to unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "LeaseExpirationTs") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiHeartbeatRequestBodyMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiHeartbeatRequestBodyMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiLeaseRequestBodyMessage struct {
LeaseExpirationTs int64 `json:"lease_expiration_ts,omitempty,string"`
// ForceSendFields is a list of field names (e.g. "LeaseExpirationTs")
// to unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "LeaseExpirationTs") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiLeaseRequestBodyMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiLeaseRequestBodyMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiPubSubCallbackMessage struct {
AuthToken string `json:"auth_token,omitempty"`
Topic string `json:"topic,omitempty"`
UserData string `json:"user_data,omitempty"`
// ForceSendFields is a list of field names (e.g. "AuthToken") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "AuthToken") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiPubSubCallbackMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiPubSubCallbackMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiPutRequestMessage struct {
Bucket string `json:"bucket,omitempty"`
// Possible values:
// "AUTO"
// "CANARY"
// "PROD"
CanaryPreference string `json:"canary_preference,omitempty"`
ClientOperationId string `json:"client_operation_id,omitempty"`
Experimental bool `json:"experimental,omitempty"`
LeaseExpirationTs int64 `json:"lease_expiration_ts,omitempty,string"`
ParametersJson string `json:"parameters_json,omitempty"`
PubsubCallback *LegacyApiPubSubCallbackMessage `json:"pubsub_callback,omitempty"`
Tags []string `json:"tags,omitempty"`
// ForceSendFields is a list of field names (e.g. "Bucket") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Bucket") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiPutRequestMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiPutRequestMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiSearchResponseMessage struct {
// Builds: Describes model.Build, see its docstring.
Builds []*LegacyApiCommonBuildMessage `json:"builds,omitempty"`
Error *LegacyApiErrorMessage `json:"error,omitempty"`
NextCursor string `json:"next_cursor,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Builds") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Builds") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiSearchResponseMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiSearchResponseMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiStartRequestBodyMessage struct {
LeaseKey int64 `json:"lease_key,omitempty,string"`
Url string `json:"url,omitempty"`
// ForceSendFields is a list of field names (e.g. "LeaseKey") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "LeaseKey") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiStartRequestBodyMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiStartRequestBodyMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type LegacyApiSucceedRequestBodyMessage struct {
LeaseKey int64 `json:"lease_key,omitempty,string"`
NewTags []string `json:"new_tags,omitempty"`
ResultDetailsJson string `json:"result_details_json,omitempty"`
Url string `json:"url,omitempty"`
// ForceSendFields is a list of field names (e.g. "LeaseKey") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "LeaseKey") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LegacyApiSucceedRequestBodyMessage) MarshalJSON() ([]byte, error) {
type NoMethod LegacyApiSucceedRequestBodyMessage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// method id "buildbucket.cancel":
type CancelCall struct {
s *Service
id int64
legacyapicancelrequestbodymessage *LegacyApiCancelRequestBodyMessage
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Cancel: Cancels a build.
func (s *Service) Cancel(id int64, legacyapicancelrequestbodymessage *LegacyApiCancelRequestBodyMessage) *CancelCall {
c := &CancelCall{s: s, urlParams_: make(gensupport.URLParams)}
c.id = id
c.legacyapicancelrequestbodymessage = legacyapicancelrequestbodymessage
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *CancelCall) Fields(s ...googleapi.Field) *CancelCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *CancelCall) Context(ctx context.Context) *CancelCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *CancelCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *CancelCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191217")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.legacyapicancelrequestbodymessage)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "builds/{id}/cancel")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"id": strconv.FormatInt(c.id, 10),
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "buildbucket.cancel" call.
// Exactly one of *LegacyApiBuildResponseMessage or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *CancelCall) Do(opts ...googleapi.CallOption) (*LegacyApiBuildResponseMessage, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &LegacyApiBuildResponseMessage{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Cancels a build.",
// "httpMethod": "POST",
// "id": "buildbucket.cancel",
// "parameterOrder": [
// "id"
// ],
// "parameters": {
// "id": {
// "format": "int64",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "builds/{id}/cancel",
// "request": {
// "$ref": "LegacyApiCancelRequestBodyMessage",
// "parameterName": "resource"
// },
// "response": {
// "$ref": "LegacyApiBuildResponseMessage"
// },
// "scopes": [
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "buildbucket.fail":
type FailCall struct {
s *Service
id int64
legacyapifailrequestbodymessage *LegacyApiFailRequestBodyMessage
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Fail: Marks a build as failed.
func (s *Service) Fail(id int64, legacyapifailrequestbodymessage *LegacyApiFailRequestBodyMessage) *FailCall {
c := &FailCall{s: s, urlParams_: make(gensupport.URLParams)}
c.id = id
c.legacyapifailrequestbodymessage = legacyapifailrequestbodymessage
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *FailCall) Fields(s ...googleapi.Field) *FailCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *FailCall) Context(ctx context.Context) *FailCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *FailCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *FailCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191217")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.legacyapifailrequestbodymessage)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "builds/{id}/fail")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"id": strconv.FormatInt(c.id, 10),
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "buildbucket.fail" call.
// Exactly one of *LegacyApiBuildResponseMessage or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *FailCall) Do(opts ...googleapi.CallOption) (*LegacyApiBuildResponseMessage, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &LegacyApiBuildResponseMessage{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Marks a build as failed.",
// "httpMethod": "POST",
// "id": "buildbucket.fail",
// "parameterOrder": [
// "id"
// ],
// "parameters": {
// "id": {
// "format": "int64",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "builds/{id}/fail",
// "request": {
// "$ref": "LegacyApiFailRequestBodyMessage",
// "parameterName": "resource"
// },
// "response": {
// "$ref": "LegacyApiBuildResponseMessage"
// },
// "scopes": [
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "buildbucket.get":
type GetCall struct {
s *Service
id int64
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Returns a build by id.
func (s *Service) Get(id int64) *GetCall {
c := &GetCall{s: s, urlParams_: make(gensupport.URLParams)}
c.id = id
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GetCall) Fields(s ...googleapi.Field) *GetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *GetCall) IfNoneMatch(entityTag string) *GetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GetCall) Context(ctx context.Context) *GetCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191217")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "builds/{id}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"id": strconv.FormatInt(c.id, 10),
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "buildbucket.get" call.
// Exactly one of *LegacyApiBuildResponseMessage or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *GetCall) Do(opts ...googleapi.CallOption) (*LegacyApiBuildResponseMessage, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &LegacyApiBuildResponseMessage{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Returns a build by id.",
// "httpMethod": "GET",
// "id": "buildbucket.get",
// "parameterOrder": [
// "id"
// ],
// "parameters": {
// "id": {
// "format": "int64",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "builds/{id}",
// "response": {
// "$ref": "LegacyApiBuildResponseMessage"
// },
// "scopes": [
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "buildbucket.heartbeat":
type HeartbeatCall struct {
s *Service
id int64
legacyapiheartbeatrequestbodymessage *LegacyApiHeartbeatRequestBodyMessage
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Heartbeat: Updates build lease.
func (s *Service) Heartbeat(id int64, legacyapiheartbeatrequestbodymessage *LegacyApiHeartbeatRequestBodyMessage) *HeartbeatCall {
c := &HeartbeatCall{s: s, urlParams_: make(gensupport.URLParams)}
c.id = id
c.legacyapiheartbeatrequestbodymessage = legacyapiheartbeatrequestbodymessage
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *HeartbeatCall) Fields(s ...googleapi.Field) *HeartbeatCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *HeartbeatCall) Context(ctx context.Context) *HeartbeatCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *HeartbeatCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *HeartbeatCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191217")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.legacyapiheartbeatrequestbodymessage)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "builds/{id}/heartbeat")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"id": strconv.FormatInt(c.id, 10),
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "buildbucket.heartbeat" call.
// Exactly one of *LegacyApiBuildResponseMessage or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *HeartbeatCall) Do(opts ...googleapi.CallOption) (*LegacyApiBuildResponseMessage, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &LegacyApiBuildResponseMessage{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Updates build lease.",
// "httpMethod": "POST",
// "id": "buildbucket.heartbeat",
// "parameterOrder": [
// "id"
// ],
// "parameters": {
// "id": {
// "format": "int64",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "builds/{id}/heartbeat",
// "request": {
// "$ref": "LegacyApiHeartbeatRequestBodyMessage",
// "parameterName": "resource"
// },
// "response": {
// "$ref": "LegacyApiBuildResponseMessage"
// },
// "scopes": [
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "buildbucket.heartbeat_batch":
type HeartbeatBatchCall struct {
s *Service
legacyapiheartbeatbatchrequestmessage *LegacyApiHeartbeatBatchRequestMessage
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// HeartbeatBatch: Updates multiple build leases.
func (s *Service) HeartbeatBatch(legacyapiheartbeatbatchrequestmessage *LegacyApiHeartbeatBatchRequestMessage) *HeartbeatBatchCall {
c := &HeartbeatBatchCall{s: s, urlParams_: make(gensupport.URLParams)}
c.legacyapiheartbeatbatchrequestmessage = legacyapiheartbeatbatchrequestmessage
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *HeartbeatBatchCall) Fields(s ...googleapi.Field) *HeartbeatBatchCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *HeartbeatBatchCall) Context(ctx context.Context) *HeartbeatBatchCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *HeartbeatBatchCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *HeartbeatBatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191217")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.legacyapiheartbeatbatchrequestmessage)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "heartbeat")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "buildbucket.heartbeat_batch" call.
// Exactly one of *LegacyApiHeartbeatBatchResponseMessage or error will
// be non-nil. Any non-2xx status code is an error. Response headers are
// in either
// *LegacyApiHeartbeatBatchResponseMessage.ServerResponse.Header or (if
// a response was returned at all) in error.(*googleapi.Error).Header.
// Use googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *HeartbeatBatchCall) Do(opts ...googleapi.CallOption) (*LegacyApiHeartbeatBatchResponseMessage, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &LegacyApiHeartbeatBatchResponseMessage{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Updates multiple build leases.",
// "httpMethod": "POST",
// "id": "buildbucket.heartbeat_batch",
// "path": "heartbeat",
// "request": {
// "$ref": "LegacyApiHeartbeatBatchRequestMessage",
// "parameterName": "resource"
// },
// "response": {
// "$ref": "LegacyApiHeartbeatBatchResponseMessage"
// },
// "scopes": [
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "buildbucket.lease":
type LeaseCall struct {
s *Service
id int64
legacyapileaserequestbodymessage *LegacyApiLeaseRequestBodyMessage
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Lease: Leases a build. Response may contain an error.
func (s *Service) Lease(id int64, legacyapileaserequestbodymessage *LegacyApiLeaseRequestBodyMessage) *LeaseCall {
c := &LeaseCall{s: s, urlParams_: make(gensupport.URLParams)}
c.id = id
c.legacyapileaserequestbodymessage = legacyapileaserequestbodymessage
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *LeaseCall) Fields(s ...googleapi.Field) *LeaseCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *LeaseCall) Context(ctx context.Context) *LeaseCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *LeaseCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *LeaseCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191217")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.legacyapileaserequestbodymessage)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "builds/{id}/lease")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"id": strconv.FormatInt(c.id, 10),
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "buildbucket.lease" call.
// Exactly one of *LegacyApiBuildResponseMessage or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *LeaseCall) Do(opts ...googleapi.CallOption) (*LegacyApiBuildResponseMessage, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &LegacyApiBuildResponseMessage{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Leases a build. Response may contain an error.",
// "httpMethod": "POST",
// "id": "buildbucket.lease",
// "parameterOrder": [
// "id"
// ],
// "parameters": {
// "id": {
// "format": "int64",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "builds/{id}/lease",
// "request": {
// "$ref": "LegacyApiLeaseRequestBodyMessage",
// "parameterName": "resource"
// },
// "response": {
// "$ref": "LegacyApiBuildResponseMessage"
// },
// "scopes": [
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "buildbucket.peek":
type PeekCall struct {
s *Service
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Peek: Returns available builds.
func (s *Service) Peek() *PeekCall {
c := &PeekCall{s: s, urlParams_: make(gensupport.URLParams)}
return c
}
// Bucket sets the optional parameter "bucket":
func (c *PeekCall) Bucket(bucket ...string) *PeekCall {
c.urlParams_.SetMulti("bucket", append([]string{}, bucket...))
return c
}
// MaxBuilds sets the optional parameter "max_builds":
func (c *PeekCall) MaxBuilds(maxBuilds int64) *PeekCall {
c.urlParams_.Set("max_builds", fmt.Sprint(maxBuilds))
return c
}
// StartCursor sets the optional parameter "start_cursor":
func (c *PeekCall) StartCursor(startCursor string) *PeekCall {
c.urlParams_.Set("start_cursor", startCursor)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *PeekCall) Fields(s ...googleapi.Field) *PeekCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *PeekCall) IfNoneMatch(entityTag string) *PeekCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *PeekCall) Context(ctx context.Context) *PeekCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *PeekCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *PeekCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191217")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "peek")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "buildbucket.peek" call.
// Exactly one of *LegacyApiSearchResponseMessage or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *LegacyApiSearchResponseMessage.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *PeekCall) Do(opts ...googleapi.CallOption) (*LegacyApiSearchResponseMessage, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &LegacyApiSearchResponseMessage{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Returns available builds.",
// "httpMethod": "GET",
// "id": "buildbucket.peek",
// "parameters": {
// "bucket": {
// "location": "query",
// "repeated": true,
// "type": "string"
// },
// "max_builds": {
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "start_cursor": {
// "location": "query",
// "type": "string"
// }
// },
// "path": "peek",
// "response": {
// "$ref": "LegacyApiSearchResponseMessage"
// },
// "scopes": [
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "buildbucket.put":
type PutCall struct {
s *Service
legacyapiputrequestmessage *LegacyApiPutRequestMessage
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Put: Creates a new build.
func (s *Service) Put(legacyapiputrequestmessage *LegacyApiPutRequestMessage) *PutCall {
c := &PutCall{s: s, urlParams_: make(gensupport.URLParams)}
c.legacyapiputrequestmessage = legacyapiputrequestmessage
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *PutCall) Fields(s ...googleapi.Field) *PutCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *PutCall) Context(ctx context.Context) *PutCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *PutCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *PutCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191217")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.legacyapiputrequestmessage)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "builds")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("PUT", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "buildbucket.put" call.
// Exactly one of *LegacyApiBuildResponseMessage or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *PutCall) Do(opts ...googleapi.CallOption) (*LegacyApiBuildResponseMessage, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &LegacyApiBuildResponseMessage{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Creates a new build.",
// "httpMethod": "PUT",
// "id": "buildbucket.put",
// "path": "builds",
// "request": {
// "$ref": "LegacyApiPutRequestMessage",
// "parameterName": "resource"
// },
// "response": {
// "$ref": "LegacyApiBuildResponseMessage"
// },
// "scopes": [
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "buildbucket.search":
type SearchCall struct {
s *Service
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Search: Searches for builds.
func (s *Service) Search() *SearchCall {
c := &SearchCall{s: s, urlParams_: make(gensupport.URLParams)}
return c
}
// Bucket sets the optional parameter "bucket":
func (c *SearchCall) Bucket(bucket ...string) *SearchCall {
c.urlParams_.SetMulti("bucket", append([]string{}, bucket...))
return c
}
// Canary sets the optional parameter "canary":
func (c *SearchCall) Canary(canary bool) *SearchCall {
c.urlParams_.Set("canary", fmt.Sprint(canary))
return c
}
// CancelationReason sets the optional parameter "cancelation_reason":
//
// Possible values:
// "CANCELED_EXPLICITLY"
// "TIMEOUT"
// "UNSET"
func (c *SearchCall) CancelationReason(cancelationReason string) *SearchCall {
c.urlParams_.Set("cancelation_reason", cancelationReason)
return c
}
// CreatedBy sets the optional parameter "created_by":
func (c *SearchCall) CreatedBy(createdBy string) *SearchCall {
c.urlParams_.Set("created_by", createdBy)
return c
}
// CreationTsHigh sets the optional parameter "creation_ts_high":
func (c *SearchCall) CreationTsHigh(creationTsHigh int64) *SearchCall {
c.urlParams_.Set("creation_ts_high", fmt.Sprint(creationTsHigh))
return c
}
// CreationTsLow sets the optional parameter "creation_ts_low":
func (c *SearchCall) CreationTsLow(creationTsLow int64) *SearchCall {
c.urlParams_.Set("creation_ts_low", fmt.Sprint(creationTsLow))
return c
}
// FailureReason sets the optional parameter "failure_reason":
//
// Possible values:
// "BUILDBUCKET_FAILURE"
// "BUILD_FAILURE"
// "INFRA_FAILURE"
// "INVALID_BUILD_DEFINITION"
// "UNSET"
func (c *SearchCall) FailureReason(failureReason string) *SearchCall {
c.urlParams_.Set("failure_reason", failureReason)
return c
}
// IncludeExperimental sets the optional parameter
// "include_experimental":
func (c *SearchCall) IncludeExperimental(includeExperimental bool) *SearchCall {
c.urlParams_.Set("include_experimental", fmt.Sprint(includeExperimental))
return c
}
// MaxBuilds sets the optional parameter "max_builds":
func (c *SearchCall) MaxBuilds(maxBuilds int64) *SearchCall {
c.urlParams_.Set("max_builds", fmt.Sprint(maxBuilds))
return c
}
// Result sets the optional parameter "result":
//
// Possible values:
// "CANCELED"
// "FAILURE"
// "SUCCESS"
// "UNSET"
func (c *SearchCall) Result(result string) *SearchCall {
c.urlParams_.Set("result", result)
return c
}
// RetryOf sets the optional parameter "retry_of":
func (c *SearchCall) RetryOf(retryOf int64) *SearchCall {
c.urlParams_.Set("retry_of", fmt.Sprint(retryOf))
return c
}
// StartCursor sets the optional parameter "start_cursor":
func (c *SearchCall) StartCursor(startCursor string) *SearchCall {
c.urlParams_.Set("start_cursor", startCursor)
return c
}
// Status sets the optional parameter "status":
//
// Possible values:
// "COMPLETED"
// "INCOMPLETE"
// "SCHEDULED"
// "STARTED"
func (c *SearchCall) Status(status string) *SearchCall {
c.urlParams_.Set("status", status)
return c
}
// Tag sets the optional parameter "tag":
func (c *SearchCall) Tag(tag ...string) *SearchCall {
c.urlParams_.SetMulti("tag", append([]string{}, tag...))
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *SearchCall) Fields(s ...googleapi.Field) *SearchCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *SearchCall) IfNoneMatch(entityTag string) *SearchCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *SearchCall) Context(ctx context.Context) *SearchCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *SearchCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *SearchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191217")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "search")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "buildbucket.search" call.
// Exactly one of *LegacyApiSearchResponseMessage or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *LegacyApiSearchResponseMessage.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *SearchCall) Do(opts ...googleapi.CallOption) (*LegacyApiSearchResponseMessage, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &LegacyApiSearchResponseMessage{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Searches for builds.",
// "httpMethod": "GET",
// "id": "buildbucket.search",
// "parameters": {
// "bucket": {
// "location": "query",
// "repeated": true,
// "type": "string"
// },
// "canary": {
// "location": "query",
// "type": "boolean"
// },
// "cancelation_reason": {
// "enum": [
// "CANCELED_EXPLICITLY",
// "TIMEOUT",
// "UNSET"
// ],
// "enumDescriptions": [
// "",
// "",
// ""
// ],
// "location": "query",
// "type": "string"
// },
// "created_by": {
// "location": "query",
// "type": "string"
// },
// "creation_ts_high": {
// "format": "int64",
// "location": "query",
// "type": "string"
// },
// "creation_ts_low": {
// "format": "int64",
// "location": "query",
// "type": "string"
// },
// "failure_reason": {
// "enum": [
// "BUILDBUCKET_FAILURE",
// "BUILD_FAILURE",
// "INFRA_FAILURE",
// "INVALID_BUILD_DEFINITION",
// "UNSET"
// ],
// "enumDescriptions": [
// "",
// "",
// "",
// "",
// ""
// ],
// "location": "query",
// "type": "string"
// },
// "include_experimental": {
// "location": "query",
// "type": "boolean"
// },
// "max_builds": {
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "result": {
// "enum": [
// "CANCELED",
// "FAILURE",
// "SUCCESS",
// "UNSET"
// ],
// "enumDescriptions": [
// "",
// "",
// "",
// ""
// ],
// "location": "query",
// "type": "string"
// },
// "retry_of": {
// "format": "int64",
// "location": "query",
// "type": "string"
// },
// "start_cursor": {
// "location": "query",
// "type": "string"
// },
// "status": {
// "enum": [
// "COMPLETED",
// "INCOMPLETE",
// "SCHEDULED",
// "STARTED"
// ],
// "enumDescriptions": [
// "",
// "",
// "",
// ""
// ],
// "location": "query",
// "type": "string"
// },
// "tag": {
// "location": "query",
// "repeated": true,
// "type": "string"
// }
// },
// "path": "search",
// "response": {
// "$ref": "LegacyApiSearchResponseMessage"
// },
// "scopes": [
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "buildbucket.start":
type StartCall struct {
s *Service
id int64
legacyapistartrequestbodymessage *LegacyApiStartRequestBodyMessage
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Start: Marks a build as started.
func (s *Service) Start(id int64, legacyapistartrequestbodymessage *LegacyApiStartRequestBodyMessage) *StartCall {
c := &StartCall{s: s, urlParams_: make(gensupport.URLParams)}
c.id = id
c.legacyapistartrequestbodymessage = legacyapistartrequestbodymessage
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *StartCall) Fields(s ...googleapi.Field) *StartCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *StartCall) Context(ctx context.Context) *StartCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *StartCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *StartCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191217")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.legacyapistartrequestbodymessage)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "builds/{id}/start")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"id": strconv.FormatInt(c.id, 10),
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "buildbucket.start" call.
// Exactly one of *LegacyApiBuildResponseMessage or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *StartCall) Do(opts ...googleapi.CallOption) (*LegacyApiBuildResponseMessage, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &LegacyApiBuildResponseMessage{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Marks a build as started.",
// "httpMethod": "POST",
// "id": "buildbucket.start",
// "parameterOrder": [
// "id"
// ],
// "parameters": {
// "id": {
// "format": "int64",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "builds/{id}/start",
// "request": {
// "$ref": "LegacyApiStartRequestBodyMessage",
// "parameterName": "resource"
// },
// "response": {
// "$ref": "LegacyApiBuildResponseMessage"
// },
// "scopes": [
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "buildbucket.succeed":
type SucceedCall struct {
s *Service
id int64
legacyapisucceedrequestbodymessage *LegacyApiSucceedRequestBodyMessage
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Succeed: Marks a build as succeeded.
func (s *Service) Succeed(id int64, legacyapisucceedrequestbodymessage *LegacyApiSucceedRequestBodyMessage) *SucceedCall {
c := &SucceedCall{s: s, urlParams_: make(gensupport.URLParams)}
c.id = id
c.legacyapisucceedrequestbodymessage = legacyapisucceedrequestbodymessage
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *SucceedCall) Fields(s ...googleapi.Field) *SucceedCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *SucceedCall) Context(ctx context.Context) *SucceedCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *SucceedCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *SucceedCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191217")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.legacyapisucceedrequestbodymessage)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "builds/{id}/succeed")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"id": strconv.FormatInt(c.id, 10),
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "buildbucket.succeed" call.
// Exactly one of *LegacyApiBuildResponseMessage or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *SucceedCall) Do(opts ...googleapi.CallOption) (*LegacyApiBuildResponseMessage, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &LegacyApiBuildResponseMessage{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Marks a build as succeeded.",
// "httpMethod": "POST",
// "id": "buildbucket.succeed",
// "parameterOrder": [
// "id"
// ],
// "parameters": {
// "id": {
// "format": "int64",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "builds/{id}/succeed",
// "request": {
// "$ref": "LegacyApiSucceedRequestBodyMessage",
// "parameterName": "resource"
// },
// "response": {
// "$ref": "LegacyApiBuildResponseMessage"
// },
// "scopes": [
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}